The callback function of array_filter () is an amazing skill in PHP. I checked the project code yesterday and saw that a line of code was written like array_filter ($ array, & nbsp; array ($ this, & nbsp; functionName). I have never seen this method before, functionName is a method name of the controller. Wondering how php works with this callback method? There is also where to learn the odd array_filter () callback function of php, which is an amazing skill of PHP.
I checked the project code yesterday and saw a line of code written like this.
Array_filter ($ array, array ($ this, 'functionname ');
I have never seen this method before. functionName is a method name of the controller. Wondering how php works with this callback method? There is also where I can learn this kind of php tricks and tricks. I don't see this in the php Manual.
------ Solution --------------------
Array array_filter (array input [, callback])
If callback is an object method, you should write an array (object name, method name)
However, I have not read much and have not seen the authoritative document of this statement. I do not remember how to know this expression.
------ Solution --------------------
The manual is written as follows:
The method of an object is transmitted as an array. the subscript 0 of the array indicates the object name, and subscript 1 indicates the method name.
For a static class that is not instantiated as an object, pass its method and replace the object name specified by the array 0 subscript with the name of this class.