Pre-defined constants in PHP:
__file__
The file name of the script currently being processed. If used in a contained file, then its value is the contained file, not the file name that contains it.
__line__
The current number of rows in the file being processed.
Php_version
Represents the current version of the PHP processor, such as: ' 3.0.8-dev '.
Php_os
The name of the operating system on which the PHP processor resides, such as: ' Linux '.
TRUE
Truth
FALSE
False value
You can define more constants with the Define function.
For example, define constants:
Define ("CONSTANT", "Hello World");
Echo CONSTANT; Outputs "Hello world."
?>
Examples of using __file__ and __line__
function Report_error ($file, $line, $message) {
echo "An error occured in $file on line $line: $message.";
}
Report_error (__file__,__line__, "Something went wrong!");
?>
The above describes the use of defines PHP define functions, including the defines aspects of the content, I hope that the PHP tutorial interested in a friend helpful.