3v4l.org

run code in 300+ PHP versions simultaneously
<?php function some_lib(array $a = [], string $b) { echo $b . PHP_EOL; } some_lib( b: 'hello' );
Output for 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
Deprecated: some_lib(): Optional parameter $a declared before required parameter $b is implicitly treated as a required parameter in /in/nHkd1 on line 2 Fatal error: Uncaught ArgumentCountError: some_lib(): Argument #1 ($a) not passed in /in/nHkd1:2 Stack trace: #0 /in/nHkd1(6): some_lib(NULL, 'hello') #1 {main} thrown in /in/nHkd1 on line 2
Process exited with code 255.
Output for 8.1.0 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30
Deprecated: Optional parameter $a declared before required parameter $b is implicitly treated as a required parameter in /in/nHkd1 on line 2 Fatal error: Uncaught ArgumentCountError: some_lib(): Argument #1 ($a) not passed in /in/nHkd1:2 Stack trace: #0 /in/nHkd1(6): some_lib(NULL, 'hello') #1 {main} thrown in /in/nHkd1 on line 2
Process exited with code 255.
Output for 8.0.0 - 8.0.30
Deprecated: Required parameter $b follows optional parameter $a in /in/nHkd1 on line 2 hello
Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Parse error: syntax error, unexpected ':', expecting ')' in /in/nHkd1 on line 6
Process exited with code 255.
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.34
Parse error: syntax error, unexpected ':', expecting ',' or ')' in /in/nHkd1 on line 6
Process exited with code 255.
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
Parse error: syntax error, unexpected ':' in /in/nHkd1 on line 6
Process exited with code 255.
Output for 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/nHkd1 on line 2
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_ARRAY, expecting '&' or T_VARIABLE in /in/nHkd1 on line 2
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_ARRAY, expecting ')' in /in/nHkd1 on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1
Parse error: parse error, unexpected T_ARRAY, expecting ')' in /in/nHkd1 on line 2
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `')'' in /in/nHkd1 on line 2
Process exited with code 255.

preferences:
92.59 ms | 2752 KiB | 4 Q