3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo(int|null $var): void {} foo("123test");
Output for 8.3.5 - 8.3.30, 8.4.9 - 8.4.17, 8.5.1 - 8.5.2
Fatal error: Uncaught TypeError: foo(): Argument #1 ($var) must be of type ?int, string given, called in /in/C0uaK on line 5 and defined in /in/C0uaK:3 Stack trace: #0 /in/C0uaK(5): foo('123test') #1 {main} thrown in /in/C0uaK on line 3
Process exited with code 255.

preferences:
44.44 ms | 406 KiB | 5 Q