3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php interface FooInterface { public function test(): FooInterface; } class Foo implements FooInterface { public function test(): Foo { echo 'test'; return $this; } } (new Foo())->test();
based on BmpXH
Output for 7.0.30 - 7.3.0alpha1
Fatal error: Declaration of Foo::test(): Foo must be compatible with FooInterface::test(): FooInterface in /in/Dr79s on line 8
Process exited with code 255.
Output for hhvm-3.18.5 - 3.22.0
test
Output for 5.6.30
Parse error: syntax error, unexpected ':', expecting ';' or '{' in /in/Dr79s on line 5
Process exited with code 255.