HOWTO: group include classes into a file

This forum covers all minor versions of PHP 7
Post Reply
User avatar
Administrator
Site Admin
Posts: 1725
Joined: Thu Mar 22, 2018 10:19 am

HOWTO: group include classes into a file

Post by Administrator » Sat Mar 24, 2018 8:31 am

In PHP 7 you can now group include classes into the namespace this will save you a little time than in previous versions of PHP.

Take a look at some typical use statements prior to PHP 7.

Code: Select all

use App\Controller\ClassA;
use App\Controller\ClassB;
use App\Controller\ClassC;
in PHP 7 this would convey the same results

Code: Select all

use App\Controller\{ClassA, ClassB, ClassC };
Although iv not seen this to be used much at the moment expect it to be common place in the future.

Post Reply