Nested namespaces in PHP

namespacesIt’s true that “Namespace declarations cannot be nested”.Namespacing is used to avoid conflicting definitions and introduce more flexibility and organization in your code.The brackets surrounding the namespace code block are completely optional.If we want to translate namespace code to run able in php. We can write like:

namespace Foo\Bar;

class X{
    // Your properties
}
class Y {
// Your properties
}

If  need more information you can see this link well written by Elias Zerrouq with example http://code.tutsplus.com/tutorials/namespacing-in-php–net-27203

Advertisements

One thought on “Nested namespaces in PHP

  1. Pingback: Nested namespaces in PHP | MD. Mahsin Ul Islam

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s