3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Foo { public function __construct() { return new Bar(); } } $foo = new Foo(); var_dump(get_class($foo));
based on Z5YfG
Output for 7.0.0 - 7.3.1
Fatal error: Uncaught Error: Class 'Bar' not found in /in/0ipEW:8 Stack trace: #0 /in/0ipEW(13): Foo->__construct() #1 {main} thrown in /in/0ipEW on line 8
Process exited with code 255.
Output for hhvm-3.15.4
Fatal error: Uncaught Error: Class undefined: Bar in /in/0ipEW:8 Stack trace: #0 /in/0ipEW(13): Foo->__construct() #1 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.30
Fatal error: Class 'Bar' not found in /in/0ipEW on line 8
Process exited with code 255.