Magic variables:
PHP provides a large number of predefined constants to any script it runs.
However, many constants are defined by different extensions, and are only present when the extensions are loaded, either dynamically after loading, or they are included at compile time.
There are eight magic constants whose values change as they change position in the code.
For example, the value of __line__ depends on the row it is in the script to determine. These special constants are case-insensitive
As follows:
Namespaces:
PHP namespaces (namespace) are added in PHP 5.3, and if you learn C # and Java, that namespace is nothing new. However, in PHP there is a very important meaning.
The PHP namespace resolves the following two types of problems:
- User-written code conflicts with the name of a class/function/constant or third-party class/function/constant inside PHP.
- Creates an alias (or short) name for a very long identifier name (usually defined to alleviate the first type of problem), improving the readability of the source code.
PHP Magic Variables and namespaces