function sayHi($words,$func){
echo $words;
call_user_func($func,26);
}
sayHi('hello world,',function($age){
echo "im murphy!{$age} years old";
});
//运行结果hello world,im murphy!26 years old
PHP匿名函数作为参数
最新推荐文章于 2021-04-09 07:30:49 发布
function sayHi($words,$func){
echo $words;
call_user_func($func,26);
}
sayHi('hello world,',function($age){
echo "im murphy!{$age} years old";
});
//运行结果hello world,im murphy!26 years old