我不知道这是否可能,但我想通过将函数作为参数传递来调用函数内的函数,例如......
timeThis(test());
function test(){
$i = 0;
echo "add 1";
$i += 1;
echo "minus 10";
$i -= l0;
}
function timeThis($fun){
$timer = new timer;
$timer->start();
$fun;
$timer->pause();
echo $timer->get();
}
在php中可能有这样的事情吗?问候。