I want to create global function with dynamic name, but I dont want to write code of function as string, as it's required in PHP docs about create_function function.
Dream scenario would be like:
$functionName = "new_super_function";
$functionBody = function($a,$b) { return $a + $b; };
if ( !function_exists($functionName) ) create_function($functionName, $functionBody);
//from here my function with dynamic name is ready
//I could now call it like call_user_func($functionName, 5, 7) => 12
//or just use it later like new_super_function(5,7) => 12
I was looking for such sort of possibility but I couldnt find anything. Any ideas?