{ echo "set {$k} {$v}\n"; $this->{$k} = $v; } public function __get($k) { echo "get {$k}\n"; return $this->{$k}; } } $obj = new C(); // These are extension functions that call into o_set() and o_get(). These // exercise t___get() and t___set(). hphp_set_property($obj, null, "priv", 1234); var_dump(hphp_get_property($obj, "unused arg", "priv")); hphp_set_property($obj, null, "pub", 123); var_dump(hphp_get_property($obj, "unused arg", "pub")); var_dump($obj); $obj = new C(); // These exercise direct property setting and getting. $obj->priv = 6789; var_dump($obj->priv); $obj->pub = 678; var_dump($obj->pub); var_dump($obj); echo "\n******************************\n\n"; class D { protected $foo; public function __get($k) {
public function setValue($obj, $value) { if ($this->isStatic()) { return hphp_set_static_property($this->info['class'], $this->info['name'], $value); } hphp_set_property($obj, $this->info['class'], $this->info['name'], $value); }
{ echo "set {$k} {$v}\n"; $this->{$k} = $v; } public function __get($k) { echo "get {$k}\n"; return $this->{$k}; } } $obj = new C(); // These are extension functions that call into o_set() and o_get(). These // exercise t___get() and t___set(). hphp_set_property($obj, "unused arg", "priv", 1234); var_dump(hphp_get_property($obj, "unused arg", "priv")); hphp_set_property($obj, "unused arg", "pub", 123); var_dump(hphp_get_property($obj, "unused arg", "pub")); var_dump($obj); $obj = new C(); // These exercise direct property setting and getting. $obj->priv = 6789; var_dump($obj->priv); $obj->pub = 678; var_dump($obj->pub); var_dump($obj); echo "\n******************************\n\n"; class D { protected $foo; public function __get($k) {