php– problems with callback functions when using Array_filter in a class

Source: Internet
Author: User

A class-handling friend with a way to sync friends, and this method needs to find the users who are concerned with each other from the list of followers and fans on the microblog, and record the experience, mostly about the callback function.

As I understand it, that's all you have to say.

Private function Getmutualfromsina ($focusList) {    returnarray_filter( $focusList, "filtersinalist");} Private function filtersinalist ($value) {    returnin_array( $value $this, fanslist);}

However, a warning is returned after execution:

Array_filter () [function. Array callback in * * * * on line 11

Later, the callback function called in the class should be written like this:

Private function Getmutualfromsina ($focusList) {    returnarray_filter( $focusList Array ($this, "filtersinalist");} Private function filtersinalist ($value) {    returnin_array( $value $this, fanslist);}

is equivalent to invoking the method normally in the class: $this->xxxx ()

php– problems with callback functions when using Array_filter in a 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.