PHP function name parameter arrayarray_filter (array $ input [, callable $ callback]) some functions such as call_user_func () or usort () can accept custom callback functions as parameters. Callback functions can not only be simple functions, but also object methods, including static class methods. An instantiated
PHP function name parameter array array_filter (array $ input [, callable $ callback = ""]) some functions such as call_user_func () or usort () user-defined callback functions can be used as parameters. Callback functions can not only be simple functions, but also object methods, including static class methods. An instantiated
PHP function name Parameters
array array_filter ( array $input [, callable $callback = "" ] )
Some functions, suchcall_user_func()
Orusort()
User-defined callback functions can be used as parameters. Callback functions can be moreSimple FunctionsCan also be an object method, includingStatic Class Method.
The method of an instantiated object is passed as an array. subscript 0 contains the object, and subscript 1 contains the method name.
Static class methods can also be passed without instantiating the class object, as long as the subscript 0 contains the class name rather than the object. From PHP 5.2.3, you can also pass 'classname: methodname '.
Except for common user-defined functions,create_function()
It can be used to create an anonymous callback function. Closure can also be passed to the callback parameter since PHP 5.3.0.
Closure
Original article address: PHP function name parameters and closures. Thank you for sharing them with me.