3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); function foo(int $num) { echo ($num . PHP_EOL); } foo('42');
Output for 8.0.0 - 8.0.2
Fatal error: Uncaught TypeError: foo(): Argument #1 ($num) must be of type int, string given, called in /in/eONU7 on line 8 and defined in /in/eONU7:4 Stack trace: #0 /in/eONU7(8): foo('42') #1 {main} thrown in /in/eONU7 on line 4
Process exited with code 255.
Output for 7.3.0 - 7.3.26, 7.4.0 - 7.4.14
Fatal error: Uncaught TypeError: Argument 1 passed to foo() must be of the type int, string given, called in /in/eONU7 on line 8 and defined in /in/eONU7:4 Stack trace: #0 /in/eONU7(8): foo('42') #1 {main} thrown in /in/eONU7 on line 4
Process exited with code 255.