my code:
class Test {
private $a = 5;
public function __set($name, $value)
{
// TODO: Implement __set() method.
echo $name . "#" .$value."<br>";
}
public static function do_test(){
$x= new Test();
$x->a=5;
}
}
$x=new Test();
$x->a=3;
Test::do_test();
output:
a#3
The function static do_test()
doesn't call the magic methods (__set
). Why?
Thank you!