PHP Magic Method Daquan

Source: Internet
Author: User
Tags export class

The 16 Magic methods are detailed below

Description: PHP, which starts with two underscores, is called the Magic Method (Magic methods), which plays a pivotal role in PHP. Magic methods include:

    1. __construct (), constructor of class

    2. __destruct (), Destructor for class

    3. __call (), called when an inaccessible method is called in an object

    4. __callstatic (), called when a non-accessible method is called in a static manner

    5. __get (), which is called when a member variable of a class is obtained

    6. __set (), which is called when a member variable of a class is set

    7. __isset (), called when isset () or empty () is called on an inaccessible property

    8. __unset () is called when unset () is called on a non-accessible property.

    9. __sleep (), when executing serialize (), this function is called first

    10. __wakeup (), when executing unserialize (), this function is called first

    11. __tostring (), which is a method of responding when a class is treated as a string

    12. __invoke (), called when a function is called in a way that responds to an object

    13. __set_state (), this static method is called when the Var_export () export class is called.

    14. __clone (), called when the object copy is complete

    15. __autoload (), attempting to load an undefined class

    16. __debuginfo () to print the required debug information


For the use of each magic method, please jump to the following link:

1190000007250604

PHP Magic Method Daquan

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.