Нужна помощь донатом
для написания учебников Kotlin, Java, C++, C#, Go, Rust, Dart
подробности по ссылке
⊗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.

← →
↑
English▼
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenTürkçeЎзбекOʻzbekTiếng Việt
We use cookies for website operation, analytics, and personalization. Data processing is carried out in accordance with the Privacy Policy.
accept all customize decline