This article mainly introduced the PHP object-oriented Magic Method Chinese explanation, understands these methods only then writes the object-oriented program, needs the friend to be possible to refer to under
The instantiated object is called automatically. Call __construct when __construct and a function with the class name function name exist, and the other does not call back.
The function of the class name is the old version of the constructor.
When an object is deleted or an object operation ends is called.
object to invoke a method. If the method does not exist, this call __call this method
Reads an object property and calls it if the object property is private
When you assign a value to an object property, it is invoked if the property is private
Is invoked when an object is printed.
Called when the object is cloned, such as: $a =new test (); $a 1=clone $a;
Serialize is called before, if the object is larger, want to cut a little something in serialization can use it.
Unserialize is invoked to do initialization work on some objects.
Detects whether an object's properties exist if the instrumented property is private and is invoked.
When you delete an object property, it is called if the object property being deleted is private
Called when the Var_export is invoked. Use the return value of the __set_state as the return value of the Var_export.
When an object is instantiated, the method is dropped if the corresponding class does not exist.