Copy the code The code is as follows:
namespace bakbaba;
function bab(){
echo "bi";
}
namespace kkk;
function k1(){
echo "k1";
}
bakbab abab ();//Use other namespaces under the kkk namespace, pay attention to the previous
use bakbaba as b;//Still under the kkk namespace, but the following method is also correct when using aliases
#use bakbaba as b;//You don’t need to use the number before it
bbab();//When using the namespace under an alias, there should be no number before it
k1();//No error is reported when calling this function, indicating that use does not affect the current namespace
The above has introduced what a namespace is and an example of a PHP namespace, including what a namespace is. I hope it will be helpful to friends who are interested in PHP tutorials.