PHP Magic Constants

tutorial and example
tutorial and example

There are various predefine PHP Magic Constants. It starts with underscore(__) and ends with double underscore.

 Magic Constant Description
__LINE__ To check current line number of the file.
__FILE__ To check full path and filename of the file.
__FUNCTION__ To check function name.
__CLASS__ To check class name.
__METHOD__ To check class method name.
PHP_VERSION To check PHP version.
PHP_INT_MAX To check PHP integer value limit. etc

Let us take an example of Magic Constants

Example1.

Example 2.

Output

Function of test class : test

Function of test class : test

Method of test class : test::testme

Class : test