3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Foo { public static function bar() : self { return new self(); } } class Foo2 extends Foo {} var_dump(Foo2::bar()); var_dump(Foo2::bar());
based on psfiD
Output for 7.0.0 - 7.3.0rc3
object(Foo)#1 (0) { } object(Foo)#1 (0) { }
Output for 5.3.23 - 5.6.28
Parse error: syntax error, unexpected ':', expecting ';' or '{' in /in/qqPtD on line 5
Process exited with code 255.