PHP Object-Oriented Magic method Chinese description _php Tutorial

Source: Internet
Author: User
1.__construct ()

Instantiating an object is called automatically. Call __construct when __construct and a function that has the class name as the function name are present, and the other is called without a back.

The function with the class name as the function name is the old version of the constructor.

2.__destruct ()

When an object is deleted or an object operation ends, it is called.

3.__call ()

object to invoke a method. If the method does not exist, call __call this method

4.__get ()

Reads an object property, if the object property is private, it is called

5.__set ()

When assigning a value to an object property, it is called if the property is private.

6.__tostring ()

It is called when an object is printed.

7.__clone ()

Called when cloning an object, such as: $a =new test (); $a 1=clone $a;

8.__sleep ()

Serialize was called before, if the object is larger, want to cut something in the serialization can use it.

9.__wakeup ()

Unserialize is called to do some initialization of the object.

10.__isset ()

Detects whether a property of an object exists and is called when the detected property is private.

11.__unset ()

Deleting an object property is called if the deleted object property is private.

12.__set_state ()

Called when the Var_export is called. Use the return value of __set_state as the return value of Var_export.

13.__autoload ()

When an object is instantiated, the method is dropped if the corresponding class does not exist.

http://www.bkjia.com/PHPjc/736805.html www.bkjia.com true http://www.bkjia.com/PHPjc/736805.html techarticle 1.__construct () instantiates an object that is automatically called. Call __construct when __construct and a function that has the class name as the function name are present, and the other is called without a back. The class name is the function name of the letter ...

  • 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.