3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php declare(strict_types=1); function foo(): string { return true; } var_dump(foo());
based on BWVrl
Output for 7.3.0 - 7.3.1
Fatal error: Uncaught TypeError: Return value of foo() must be of the type string, bool returned in /in/tGgVk:6 Stack trace: #0 /in/tGgVk(9): foo() #1 {main} thrown in /in/tGgVk on line 6
Process exited with code 255.
Output for 7.0.0 - 7.2.13
Fatal error: Uncaught TypeError: Return value of foo() must be of the type string, boolean returned in /in/tGgVk:6 Stack trace: #0 /in/tGgVk(9): foo() #1 {main} thrown in /in/tGgVk on line 6
Process exited with code 255.
Output for hhvm-3.15.4
Fatal error: Uncaught TypeError: Value returned from function foo() must be of type string, bool given in /in/tGgVk:6 Stack trace: #0 /in/tGgVk(9): foo() #1 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.38
Warning: Unsupported declare 'strict_types' in /in/tGgVk on line 2 Parse error: syntax error, unexpected ':', expecting '{' in /in/tGgVk on line 4
Process exited with code 255.