The callback function of array_filter () is an amazing skill in PHP. How to solve

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.