PHP program to print the function name using magic constant __FUNCTION__

bookmark

<?php
    //PHP program to print the function name 
    //using magic constant __FUNCTION__.
    class Sample
    {
        public function MyFunction()
        {
            print("Function Name: ".__FUNCTION__."<br>");
        }
    }
    
    $S=new Sample();
    $S->MyFunction();
?>

 

Output
Function Name: MyFunction