3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo { private $proxy; public function __construct(self $proxy = null) { $this->proxy = $proxy ?: $this; } public function getFoo() { extract(['this' => $this->proxy]); return $this->foo; } } class fooProxy extends foo { protected $proxy; private $foo; public function __construct($foo) { $this->foo = $foo; } public function __set($name, $value) { echo __FUNCTION__, "\n"; $this->$name = $value; } public function __get($name) { echo __FUNCTION__, "\n"; return $this->$name; } } $p = new fooProxy(123); echo $p->getFoo(); echo "\n";

preferences:
55.68 ms | 402 KiB | 5 Q