I have a list of functions a()
, b()
, c()
I have a main()
function.
Depending on case, I need to pass a different function to main() to use.
In javascript it would be:
var a = function(){}
var b = function(){}
var c = function(){}
var func = (some logic) a, b or c;
main(func);
How do I do that in php5.3?
I am trying to avoid using
$func_name = "a";
main($func_name){
$func_name();
}
Or may be it is the best way, and I should not use closures of any type?