How to write code that works in the following example without __get
and __set
.Everything else can.
class A {
// What code to write here?
}
$a = new A();
$a->setName = function(A $a, $value)
{
$a->name = $value;
};
$a->getName = function(A $a)
{
return $a->name;
};
$a->setName('Vasya');
echo $a->getName1();