PHP provides a large number of predefined constants to any script it runs. However, many constants are defined by different extension libraries. they only appear when these extension libraries are loaded, dynamically loaded, or included during compilation.
PHP provides a large number of predefined constants to any script it runs. However, many constants are defined by different extension libraries. they only appear when these extension libraries are loaded, dynamically loaded, or included during compilation.
Five magic constants change based on their locations. For example, the value of _ LINE _ depends on the rows in the script. These special constants are case-insensitive.
The current row number in the _ LINE _ file.
The complete path and FILE name of The _ FILE. If it is used in a file to be included, the file name to be included is returned. Starting from PHP 4.0.2, __file _ always contains an absolute path (if it is a symbolic connection, it is an absolute path after resolution ), earlier versions sometimes contain a relative path.
The directory where the _ DIR _ file is located. If it is used in included files, the Directory of the included files is returned. It is equivalent to dirname (_ FILE __). Unless it is the root directory, the name of the directory does not include the slash at the end. (Added in PHP 5.3.0) =
_ FUNCTION name (new in PHP 4.3.0 ). Starting from PHP 5, this constant returns the name (case sensitive) when the function is defined ). In PHP 4, the value is always lowercase letters.
_ CLASS name (new in PHP 4.3.0 ). Starting from PHP 5, this constant returns the name (case sensitive) when the class is defined ). In PHP 4, the value is always lowercase letters.
_ METHOD _ class METHOD name (new PHP 5.0.0 ). Returns the name (case sensitive) when the method is defined ).
_ NAMESPACE _ name of the current NAMESPACE (case sensitive ). This constant is defined during compilation (new in PHP 5.3.0)