⊗ppOpNsFN 99 of 107 menu

Namespaces in Files in OOP in PHP

The namespace command can be used not only in files with class definitions, but also in any other files. For example, let's define a namespace in the file index.php:

<?php namespace Admin; ?>

Suppose an object of the Controller class is created in the file index.php:

<?php namespace Admin; new \Admin\Controller; ?>

Simplify the code for creating the object, taking into account that the creation of the class object occurs in the same namespace to which the class belongs.

uzltrhuuzcsv