3v4l.org

run code in 300+ PHP versions simultaneously
<?php function a(int $int1, int2 $int2 = null) { return $int1 + $int2; } function b(int $int1, ?int $int2) { return $int1 + $int2; } var_dump(a(1)); var_dump(b(1));
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
int(1) Fatal error: Uncaught ArgumentCountError: Too few arguments to function b(), 1 passed in /in/IWsqK on line 12 and exactly 2 expected in /in/IWsqK:7 Stack trace: #0 /in/IWsqK(12): b(1) #1 {main} thrown in /in/IWsqK on line 7
Process exited with code 255.

preferences:
54.67 ms | 402 KiB | 62 Q