THE WORLD'S LARGEST WEB DEVELOPER SITE
PYTHON
 

PHP 7 use Statement




PHP 7 single statement used to import Classes, functions and constants from same namespace instead of multiple use statements.


PHP - Sort Functions For Arrays

<?php
    // Before PHP 7
    use com\welookups\ClassA;
    use com\welookups\ClassB;
    use com\welookups\ClassC as C;

    use function com\welookups\fn_a;
    use function com\welookups\fn_b;
    use function com\welookups\fn_c;

    use const com\welookups\ConstA;
    use const com\welookups\ConstB;
    use const com\welookups\ConstC;

    // PHP 7+ code
    use com\welookups\{ClassA, ClassB, ClassC as C};
    use function com\welookups\{fn_a, fn_b, fn_c};
    use const com\welookups\{ConstA, ConstB, ConstC};

?>