Syntax:
$string = __FUNCTION__
Description: This constant is used to return the function name, or {closure} for anonymous functions.
Program 1: PHP program to print function name inside the function company().
Example 1:
<?php
function companywebsite() {
// Magic function constant which
// holds the function name, or
// {closure} for anonymous functions
$string = __FUNCTION__;
// Display the result
echo $string;
}
// Function call
companywebsite();
?>
<?php
function company() {
// Magic function constant which
// holds the class method name
$string = __METHOD__;
// Display the result
echo $string;
}
// Function call
company();
?>