php7 depth understanding of anonymous and callback functions

  匿名函数是没有名称的函数,可以将函数赋值给变量,再调用使用,回调函数是指作为一个参数值传值另外一个函数使用的函数。

// anonymous function not a function name

$a=function (){
echo "www.96net.com.cn";
}

$a();

// callback function name as an argument for the use of other functions

call_user_func ( "function name", parameter)

function $a(){
echo "www.96net.com.cn";
}

call_user_func("a",参数)

Also equivalent to an anonymous function can be passed into use

Guess you like

Origin blog.51cto.com/13959155/2456956
Recommended