- Edited
class classname {
private $attribute;
function __get($name){
return $this->$name;
}
function __set($name,$value){
$this->$name = $value;
}
}
$a = new classname();
$a->attribure = 5;
echo $a->attribure;
I pass only one parametr to __set and they are two parameters $name,$value and with __get I pass any parameter to $name.
I don't understand $a->attribute = 5, I suppose I pass the parameter to private $attribute but not pass any parameter to __set or __get