PHP Predefined Constants
ADVERTISEMENTS
PHP has some predefined constants.
There are eight predefined constants, These constants are case-insensitive.
# | Constant | Description |
---|---|---|
1 | __LINE__ | Get the current line number of the file. |
2 | __FILE__ | Get the full path and filename of the file with symlinks resolved. If It used inside an include, the name of the included file is returned as text. |
3 | __DIR__ | Get the directory of the file. If It used inside an include, the directory of the included file is returned as text. |
4 | __FUNCTION__ | Get the function name. |
5 | __CLASS__ | Get the class name. The class name includes the namespace. |
6 | __TRAIT__ | Get the trait name. The trait name includes the namespace. |
7 | __METHOD__ | Get the class method name. |
8 | __NAMESPACE__ | Get the name of the current namespace. |