3v4l.org

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