PHP Magic method definition Magic fast bucket poker Magic deadly Magic

Source: Internet
Author: User
PHP has a number of special functions and methods, these functions and methods compared to the ordinary method of the special point is that the user code is usually not active invocation, but at a specific time will be automatically called by PHP .

In PHP, usually the "__" method is used as a magic method, the PHP manual recommends that the custom method do not use __.

The magic Methods of PHP are:

__construct (), __destruct (), __call (), __callstatic (), __get (), __set (), __isset (), __unset (), __sleep (), __wakeup (), __ ToString (), __invoke (), __set_state (), __clone () and __debuginfo ()

__construct (), construction method, familiar with object-oriented students should be familiar with the new object in the time to allocate space for the object.

__destruct (), the constructor method corresponds to the Destructor method, which allows some operations to be performed before destroying a class or to complete functions such as closing a file, releasing a result set, and so on. destructors cannot have parameters

The above describes the PHP magic method definition, including the PHP magic method of content, I hope that the PHP tutorial interested in a friend helpful.

  • Related Article

    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.