In the previous article, we learned about namespaces and how to define namespaces. If necessary, please read "php namespace: How to define space?"》. This time we introduce sub-namespaces to you, you can refer to them if necessary.
In PHP, namespaces can help us do many things. We can prevent the names we define from conflicting with PHP internal names, and we can also give the identifier a shorter name to make it easier for us to use and read.
And it also has an important function, but let us look at a small example first, and then we will talk about what this function is.
Let’s take a look at this and then look at the namespace in the previous article.
Compare it carefully. Do you find any differences?
Let us shift our attention tonamespace
. Are the words a little different? In the above example, there are "\#" between words. ##", and the following is just one word. Everyone can see it.
MyProject\Sub\Level\CONNECT_OK, class
MyProject\Sub\Level\Connectionand function
MyProject\Sub\Level\Connect.
The above is the detailed content of What is the php namespace child namespace?. For more information, please follow other related articles on the PHP Chinese website!