PHP's new feature use enhances usage

小云云
Release: 2023-03-20 22:00:01
Original
2703 people have browsed it

This article mainly shares with you the enhanced use of PHP's new feature use. Classes, functions and constants imported from the same namespace can now be imported at once through a single use statement.

<?php//  
PHP 7 
之前版本用法use some\namespace\ClassA;use some\namespace
\ClassB;use some\namespace\ClassC as C;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;// 
PHP 7+ 用法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};
?>
Copy after login

Related recommendations:

Javascript tutorial use strict strict mode detailed explanation

How to use the use function in SeaJS

Javascript tutorial use strict strict mode detailed explanation

The above is the detailed content of PHP's new feature use enhances usage. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!