同じプロパティの再帰制限__get
をオーバーライドする方法はありますか。__set
最初のエントリとは異なる方法で 2 回目の再エントリを処理できるようにしたいと考えています。
このコード例は実用的ではありませんが、最も簡単に説明できます。
class Foo {
public function __set($name,$value){
print "$name entered\n";
this->$name = $value; // want it to recurse here
}
}
$a = new Foo();
$a->baz = "derp";
print $a->baz;
// should get (cannot test at the moment)
// baz entered
// derp <- you get derp because the current php implementation creates an instance variable from the second call to __set
インターネットがダウンしているため、携帯電話で入力しているため、タイプミスが発生する可能性があります。