Magic Constant

Magic constants are the predefined constants in PHP which get changed on the basis of their use. Magic constants begin with two underscores ( __ ) and end with two underscores. These special constants are case-insensitive. Some of them are as follows :

__LINE__  : Return the current line number where it is used.

__FILE__ : Return the full path and filename of the file.

__DIR__ : Returns the full directory path of the file.

__FUNCTION__ : Return the function name as it was declared.

__CLASS__ : Return the class name as it was declared.

__METHOD__ : returns the method name as it was declared.


Next Topic :