3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php declare(strict_types=1); class InterfaceA { function beMyself(): self; } class ClassA extends InterfaceA { function beMyself(): self { return $this; } } var_dump((new ClassA)->beMyself());
Output for 7.0.0
Fatal error: Non-abstract method InterfaceA::beMyself() must contain body in /in/UJcRi on line 7
Process exited with code 255.
Output for 5.3.20 - 5.6.16
Warning: Unsupported declare 'strict_types' in /in/UJcRi on line 3 Parse error: syntax error, unexpected ':', expecting ';' or '{' in /in/UJcRi on line 7
Process exited with code 255.