3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A { public $b; public function __construct($b) { $this->b = $b; } public function methodA() { return $this->b; } } class ProxyA extends A { private $proxied; public function methodA() { return $this->proxied->methodA(); } public function methodB() { return true; } public static function makeProxy(A $instance) { $rc = new \ReflectionClass(get_class($instance)); $proxy = $rc->newInstanceWithoutConstructor(); $proxy->proxied = $instance; return $proxy; } } var_dump(ProxyA::makeProxy(new A(1234))->methodB());
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Call to undefined method A::methodB() in /in/RGDYp:44 Stack trace: #0 {main} thrown in /in/RGDYp on line 44
Process exited with code 255.
Output for 5.4.2 - 5.6.28
Fatal error: Call to undefined method A::methodB() in /in/RGDYp on line 44
Process exited with code 255.
Output for 5.3.18 - 5.3.29
Fatal error: Call to undefined method ReflectionClass::newInstanceWithoutConstructor() in /in/RGDYp on line 36
Process exited with code 255.