Mega Code Archive

 
Categories / Php / Functions
 

Calling Functions Dynamically

<!--    In PHP, you can call functions dynamically    1.   Declare a function    2.   Then declare a variable and assign the function name to the variable (as a string)    3.   Then use the variable as a function --> <?php   function addition ($a, $b){       echo ($a + $b), "\n";   }   $result = "addition";   $result (3,6); ?>