实际上,我希望创建一个功能,将所有类似的功能与类似的功能名称结合在一起。例如,在php中为函数名添加参数?
<?php
//this function carry the function name I wish to create. For example:function try
a("try");
function a($arg)
{
//I wish to create function with the name carried by $arg
//but function $arg won't work
}
?>
任何人都可以指导我有关这样的功能吗?
你能详细说明你为什么要这样做吗?这种破碎的设计气味,我相信有一个更好的方式来实现你想要的 –
你的意思是你是在一条线后,将调用函数b?在这种情况下,您需要变量变量$$ arg,但我同意@Pekka会有更好的方法。 –
(ref)[create_function](http://php.net/manual/function.create-function.php) – Yoshi