3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Foo { public function __construct() { return new Bar(); } public static function create() { return new Bar(); } } class Bar {} $foo = Foo::create(); var_dump(get_class($foo));
based on 9QSF7
Output for 5.5.0 - 7.3.0beta1
string(3) "Bar"