Home > Article > Backend Development > PHP namespace namespace usage example analysis
The examples in this article describe the usage of PHP namespace namespace. Share it with everyone for your reference. The details are as follows:
namespace (namespace) is equivalent to functions and classes. It divides an area. This way, the same class can be required on the same page and the same name can be used. Function
: It is rarely used in projects
name.php:
'; } public function name(){ echo 'i use space'.'
'; } } //$me = new me(); function me(){ echo 'is me'.'
'; }
common.php:
'; } }
name(); i\me(); $com = new me();
The running effect is as follows:
I hope this article will be helpful to everyone in PHP programming.
For more articles related to PHP namespace namespace usage example analysis, please pay attention to the PHP Chinese website!