PHP Magic Constants:
In PHP there are various predefined constants, but many of the constants are created by various extensions and could be implemented only when those extensions are available. These extensions could be available either by dynamic loading or they have been compiled before.
There are many magical constants are available in PHP, but seven magical constants are most important, like _LINE_, _DIR_, _FILE_ etc. These constants are case-sensitive. Use of the magic constants are as follows:
1) __LINE__: This constant is used to indicate the current line number of the file.
2) __DIR__ : This constant is used to indicate the current directory in which the file is present
3) __FILE__ : This constant is used to indicate the full path of the file
4) __CLASS__ : Returns the class name
5) __FUNCTION__ : Returns the function name
6) __METHOD__ : Returns the function name
7) __NAMESPACE__ : Displays the namespace in which we are working.
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.