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:
__construct (), constructor of class
__destruct (), Destructor for class
__call (), called when an inaccessible method is called in an object
__callstatic (), called when a non-accessible method is called in a static manner
__get (), which is called when a member variable of a class is obtained
__set (), which is called when a member variable of a class is set
__isset (), called when isset () or empty () is called on an inaccessible property
__unset () is called when unset () is called on a non-accessible property.
__sleep (), when executing serialize (), this function is called first
__wakeup (), when executing unserialize (), this function is called first
__tostring (), which is a method of responding when a class is treated as a string
__invoke (), called when a function is called in a way that responds to an object
__set_state (), this static method is called when the Var_export () export class is called.
__clone (), called when the object copy is complete
__autoload (), attempting to load an undefined class
__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