PHP Magic Constants

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.
<!DOCTYPE html>
<html>
<body>
<?php
echo "Used of [ __LINE__ ] Magic Constant"."<br>";
  echo "The Line number : ". __LINE__;
?>
</body>
</html>
Example 2.
<?php
class test{
  function test(){
              echo "Function of test class : ". __FUNCTION__ ."<br/>";
  }
  functiontestme(){
              echo "Method of test class : ". __METHOD__ ."<br/>";
              echo "Class : ". __CLASS__;                                
  }
}
$object=new test();
$object->test();
$object->testme();
?>
Output Function of test class : test Function of test class : test Method of test class : test::testme Class : test