Home >Backend Development >PHP Tutorial >PHP magic method __set __get method
First take a look at the explanation of the official document
__set() is run when writing data to inaccessible properties.
__get() is utilized for reading data from inaccessible properties.
How to translate it in Chinese? inaccessible: n. Difficult to reach; difficult to approach; incomprehensible.
There is code and there is truth:
$name )
{
is set function"
->b);
$s ->f
= 3; 2. The __set() method is called when assigning a value to an inaccessible property |