I tried looking everywhere for this, or perhaps it just cannot be done?
So say I want to have a function that is used to create other functions which have a new function name based on a passed in argument, is this even possible?
I keep getting function undefined. Beyond the currying ability, can you name the nested function with a parameter and return the nested function to be called later (by the name you gave it in the parameter)?
function maker_of_functions($secFuncName, $foo) {
$secFuncName = function($bar) {
$fooBar = $foo + $bar;
}
return $secFuncName();
}
The later in the code call:
maker_of_functions('adder', 3);
echo adder(5);