例如:
class Foo() {
const BAR_FUNC = 'bar';
//!!!the following function name needs to use self::BAR_FUNC rather than "hardcoded" text "bar" in the function name
function get_default_bar() {
return 'this is my bar';
}
}
创建并调用动态命名的函数
$tmp = "foo";
$$tmp = function() {
global $tmp;
echo $tmp;
};
$$tmp();