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.4.1 - 8.4.12
Deprecated: a(): Implicitly marking parameter $int2 as nullable is deprecated, the explicit nullable type must be used instead in /in/IWsqK on line 3 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.
Output for 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25
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:
69.12 ms | 408 KiB | 5 Q