3v4l.org

run code in 300+ PHP versions simultaneously
<?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());
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.5.24 - 5.5.30, 5.6.8 - 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.

preferences:
171.56 ms | 1395 KiB | 24 Q