3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); function a(): int { return true; } var_dump(a());
Output for 8.3.0 - 8.3.7
Fatal error: Uncaught TypeError: a(): Return value must be of type int, true returned in /in/teZn3:4 Stack trace: #0 /in/teZn3(7): a() #1 {main} thrown in /in/teZn3 on line 4
Process exited with code 255.
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18
Fatal error: Uncaught TypeError: a(): Return value must be of type int, bool returned in /in/teZn3:4 Stack trace: #0 /in/teZn3(7): a() #1 {main} thrown in /in/teZn3 on line 4
Process exited with code 255.
Output for 7.3.16 - 7.3.33, 7.4.0 - 7.4.33
Fatal error: Uncaught TypeError: Return value of a() must be of the type int, bool returned in /in/teZn3:4 Stack trace: #0 /in/teZn3(7): a() #1 {main} thrown in /in/teZn3 on line 4
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33
Fatal error: Uncaught TypeError: Return value of a() must be of the type integer, boolean returned in /in/teZn3:4 Stack trace: #0 /in/teZn3(7): a() #1 {main} thrown in /in/teZn3 on line 4
Process exited with code 255.
Output for 5.6.0 - 5.6.24
Warning: Unsupported declare 'strict_types' in /in/teZn3 on line 2 Parse error: syntax error, unexpected ':', expecting '{' in /in/teZn3 on line 3
Process exited with code 255.

preferences:
181.85 ms | 401 KiB | 186 Q