Namespaces in PHP

It is possible to create a namespace in PHP. It is done by using namespace keyword followed by the name of the namespace. Why namespace is needed? If multiple developers work on the same project, than it is possible to have class names collisions, different developers may name classes by the same name. To prevent this collision issue from happening, each developer will create classes in its own namespace. Even so class names may be the same, they will be treated as different classes because they belong to different namespaces.

Comments

Popular posts from this blog

Absolute and relative path in HTML pages

Errors

goto PHP operator