return the function name from a function call or calculation : Dynamic Function « Functions « PHP






return the function name from a function call or calculation

 
<?php 
function ShowSimple($val) { 
    echo "$val\n"; 
} 
function ShowComplex($val) { 
    echo "The value is " . number_format($val) . "\n"; 
} 

$v = 1234567; 
$a = "ShowSimple"; 
$b = "ShowComplex"; 
$a($v); 
$b($v); 
?>
  
  








Related examples in the same category

1.Calling Functions Dynamically
2.Calling a Function Dynamically
3.Calling Variable Functions
4.Calling a Function Dynamically
5.Creating Dynamic Functions
6.Variable function example
7.Variable Function Names
8.Using a variable function determined by some input variable
9.String Manipulation
10.Using Arrays of Lambda Functions