你能做的是
$thing = 'some_function';$$thing = function() { echo 'hi';};$some_function();在php
<5.3中,您必须使用
create_function而不是匿名函数:
// Use this in < 5.3$thing = 'some_function';$$thing = create_function('', 'echo "hi";');$some_function();话虽这么说,用动态名称定义函数不是一个好主意。而是创建一个您要调用的函数数组,或使用多态性。



