3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test($a = 1, $b) { echo $a, $b; } test(b: 2);
Output for 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Deprecated: Optional parameter $a declared before required parameter $b is implicitly treated as a required parameter in /in/DmhYG on line 3 Fatal error: Uncaught ArgumentCountError: test(): Argument #1 ($a) not passed in /in/DmhYG:3 Stack trace: #0 /in/DmhYG(7): test(NULL, 2) #1 {main} thrown in /in/DmhYG on line 3
Process exited with code 255.
Output for 8.0.0 - 8.0.30
Deprecated: Required parameter $b follows optional parameter $a in /in/DmhYG on line 3 12
Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Parse error: syntax error, unexpected ':', expecting ')' in /in/DmhYG on line 7
Process exited with code 255.

preferences:
161.98 ms | 401 KiB | 152 Q