Anonymous function is a function without a name. You can assign the function to a variable and then call it.
The callback function refers to a function that is used as a parameter value for another function.
(Free learning video tutorial sharing: php video tutorial)
Code examples are as follows:
//匿名函数 没名称的函数 $a=function (){ echo "m.sbmmt.com"; } $a(); //回调函数 函数名作为参数供其他函数使用 call_user_func("函数名",参数) function $a(){ echo "m.sbmmt.com"; } call_user_func("a",参数) //也相当于可以传入一个匿名函数进去使用
Recommended related article tutorials: php tutorial
The above is the detailed content of Detailed explanation of anonymous functions and callback functions in php. For more information, please follow other related articles on the PHP Chinese website!