3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $foo =2; } class Proxy extends Foo { public function getFoo() { $getter = function(){return $this->foo;}; return \Closure::bind($getter, $this, 'Foo'); } } $hydrated = new Proxy(); $getter = $hydrated->getFoo(); var_dump($getter());

preferences:
48.72 ms | 402 KiB | 5 Q