Connect with us


namespace in php


namespace in php

what are namespaces in c sharp


  1. it is used to control the scope of classes in larger projects
  2. it is used to organize classes
  3. It is used to avoid code duplication in classes when there are multile vendors code
  4. php provides us directive for shortening class which method is defined.
  5. namespace is big term defined and used when oop began to working.
  6. It is big vendor term where we can use different classes defined by different vendor names without any function

classes methods either they are same or not provided namespace keywod with relevative bundle container imported.
Namespace actually provides us the logic of wheel reinventing so it revolutioned our programming and led us to faster development.They make us avoid from collapsing against classes ,bundles, containter etc.

namespace in php

Namespaces are php program elements designed to help you organize your programs. when we write a class named Library, we would need to put it in our own namespace to ensure that there wasn’t any confusion about when Library class should be used or when your class should be used. Generally, it would be a bad idea to create a class named Library, but in many cases your classes will be named the same as classes in either the php namespace classesor a third party library and namespaces help you avoid the problems that identical class names would cause.


Namespaces don’t correspond to file or directory names. If naming directories and files to correspond to namespaces helps you organize your code, then you may do so, but it is not required.

The big example of website where different vender bundles are defined and work without any class or function or method or interface collasping with each other.

Learn more about php and its function

Continue Reading
You may also like...

More in php


To Top