In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-10-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "what are the Group use declarations features of php7". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what are the Group use declarations features of php7".
Group use declarations of new features of php7
Classes, functions, and constants imported from the same namespace can now be imported at once through a single use statement.
I think this new feature should be used a lot, because in the past, when php7 introduced classes under the same namespace, there were only several use, as shown below:
/ / the code before PHP 7, use some\ namespace\ ClassA;use some\ namespace\ ClassB;use some\ namespace\ ClassC as Cash use function some\ namespace\ fn_a;use function some\ namespace\ fn_b;use function some\ namespace\ fn_c;use const some\ namespace\ ConstA;use const some\ namespace\ ConstB;use const some\ namespace\ ConstC
Among the new features of php7, batch support has been introduced, which greatly reduces the use of duplicate code:
/ / PHP 7 + and later code use some\ namespace\ {ClassA, ClassB, ClassC as C}; use function some\ namespace\ {fn_a, fn_b, fn_c}; use const some\ namespace\ {ConstA, ConstB, ConstC}
The above sample code is from the php official manual, very simple, do not need to say more, look and use it.
Thank you for your reading, the above is the content of "what is the Group use declarations feature of php7". After the study of this article, I believe you have a deeper understanding of what the Group use declarations feature of php7 is, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.