Php callback function

Source: Internet
Author: User
Many php Functions Support callback functions such as array_udiff and the array_usort callback function requires a callback type as its parameter, the official documentation clearly specifies six supported callback function parameter input methods. 1. Common global method 2. Object method, input array as parameter 3. static method call, input array as parameter 4

Many php Functions Support callback functions such as array_udiff and the array_usort callback function requires a callback type as its parameter, the official documentation clearly specifies six supported callback function parameter input methods. 1. Common global method 2. Object method, input array as parameter 3. static method call, input array as parameter 4

Many php Functions Support callback functions such as array_udiff, array_usort... The callback function needs to pass in a callback type as its parameter. The official documentation clearly specifies six supported callback function parameter input methods.
1. Common global methods
2. Object method. Input an array as a parameter.
3. static method call. Input an array as a parameter.
4. static method call. input strings as parameters
5. Common Methods of the parent class
6. closure or anonymous method

 

These are all anonymous functions called outside the class. What should we do when we want to call a method of this class inside the class?
In this case, we can use $ this

 property;    }}?>

In the past, I was stupid to define a global method in the header or tail of a single class file to solve this problem. Later I found that it could be called in this way, and I hope it will be helpful to everyone.
This call method is provided in the comments below the official document,

Original article address: php callback function. Thanks for sharing it with the original author.

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.