magic constant in php
<?php
echo "It will return current line number: ".__LINE__;
echo '<br>';
echo "It will return full path of file: ".__FILE__;
echo '<br>';
echo "It will return directory of executed file: ".__DIR__;
echo '<br>';
class Car
{
function demoMagic()
{
echo "It will return name of function where magic constant included: ".__FUNCTION__;
echo '<br>';
echo "It will return name of class where magic constant included: ".__CLASS__;
echo '<br>';
echo "It will return name of method with class where magic constant included: ".__METHOD__;
}
}
$obj = new Car();
$obj->demoMagic();
?>