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

One thought on “Nested namespaces in PHP

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

Leave a comment