In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article is about how PHP namespaces are implemented. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Implementation of PHP Namespace
Unlike C# and Java,PHP, code without namespaces has to be compatible. This has been implemented, and you can choose to use or not use namespaces. However, if you use PHP 5.3 or later, I recommend using namespaces, even if you only use the same name in your project.
It seems logical to use namespace and use as namespace operators. Some developers may disagree, but it doesn't really matter how they are named in this case. *, back to the question of backslashes. Most critics think it's ugly, hard to read, and hard to type on Mac. Even so, I still think it is better than the two colons that have been proposed. For example, the following static method call:
/ / PHP 5.3 beta static method call echo:: App::Lib1::MyClass::WhoAmI (); / / PHP 5.3 official static method call echo\ App\ Lib1\ MyClass::WhoAmI ()
The second line can be entered quickly, with fewer errors, easy to read, and easy to understand. If you see a backslash outside a string, you know that there must be a namespace.
Of course, if PHP uses "." It is better to be public methods, static methods, and namespaces. This is consistent with Java, C #, JavaScript, Python, and many other languages. Unfortunately, the history and backward compatibility of PHP make this difficult to achieve.
No language is *, and PHP will not be a member of * languages. In any case, namespaces have been well implemented, especially given the limitations and problems that may arise.
Thank you for reading! This is the end of the article on "how to implement PHP Namespace". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.