I am just amazed that why below code does not work
function test(){
echo "this is test";
}
function getName($f)
{
return $f;
}
getName("test")();
It works when I put function name in variable like this
$f = getName("test");
$f();
What could be the reason?
that's not possible to call a multiple functions directly, you must have to store return values to other function and then try to call other function.
Instead, if you want to access multiple functions at a same time just call other function in the first function. See below code for your reference
function test() {
echo "this is test";
}
function getName($f) {
$a = $f();
return $a;
}
getName("test");