Calling Variable Functions
<?php
function addvalues ($firstvalue = 0, $secondvalue = 0){
return $firstvalue + $secondvalue;
}
function subtractvalues ($firstvalue = 0, $secondvalue = 0){
return $firstvalue - $secondvalue;
}
function multiplyvalues ($firstvalue = 0, $secondvalue = 0){
return $firstvalue * $secondvalue;
}
$firstvalue = 10;
$secondvalue = 3;
$whattodo = "addvalues";
echo $whattodo($firstvalue, $secondvalue) . "<br />";
$whattodo = "subtractvalues";
echo $whattodo($firstvalue, $secondvalue) . "<br />";
?>
Related examples in the same category