problem description
defines a class with variable name in A, A. The name variable is defined by the _ _ set () method, and the method tell in A cannot take the value of name. This is why there is no way to go to the value of name
class A {
private $name;
public function __set($property,$value){
$this->property = $value;
}
public function tell(){
echo $this->name;
}
}
$a = new A ();
$a-> name= "Zhang San";
/ / call the tell () method, but $this- > name has no value
$a-> tell ();