3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php declare(strict_types = 1); phpversion() >= "7.0.0" or die(); class Nul { } class C extends Nul { } function m() : C { return new Nul; } var_dump(m());
based on U6hEr
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught TypeError: Return value of m() must be an instance of C, instance of Nul returned in /in/LtqQD:14 Stack trace: #0 /in/LtqQD(17): m() #1 {main} thrown in /in/LtqQD on line 14
Process exited with code 255.
Output for 5.3.20 - 5.6.21
Warning: Unsupported declare 'strict_types' in /in/LtqQD on line 1 Parse error: syntax error, unexpected ':', expecting '{' in /in/LtqQD on line 12
Process exited with code 255.