3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); class Test { public function getIt(): string { return 1; } } var_dump((new Test)->getIt());
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
Fatal error: Uncaught TypeError: Test::getIt(): Return value must be of type string, int returned in /in/F0rum:7 Stack trace: #0 /in/F0rum(11): Test->getIt() #1 {main} thrown in /in/F0rum on line 7
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 Test::getIt() must be of the type string, int returned in /in/F0rum:7 Stack trace: #0 /in/F0rum(11): Test->getIt() #1 {main} thrown in /in/F0rum on line 7
Process exited with code 255.
Output for 7.1.0 - 7.1.23, 7.2.0 - 7.2.33
Fatal error: Uncaught TypeError: Return value of Test::getIt() must be of the type string, integer returned in /in/F0rum:7 Stack trace: #0 /in/F0rum(11): Test->getIt() #1 {main} thrown in /in/F0rum on line 7
Process exited with code 255.
Output for 5.6.38
Warning: Unsupported declare 'strict_types' in /in/F0rum on line 2 Parse error: syntax error, unexpected ':', expecting ';' or '{' in /in/F0rum on line 6
Process exited with code 255.

preferences:
66.81 ms | 1489 KiB | 4 Q