3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo(...$args) { // This used to be list<positive-int|0> :-( var_dump(array_keys($args)); } foo(3, 4, 1, 2, 5, 7); foo(f: 3, g: 4, a: 1, b: 2, z: 5, w: 7);
Output for 8.0.0 - 8.0.3, 8.1.23 - 8.1.28, 8.2.10 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
array(6) { [0]=> int(0) [1]=> int(1) [2]=> int(2) [3]=> int(3) [4]=> int(4) [5]=> int(5) } array(6) { [0]=> string(1) "f" [1]=> string(1) "g" [2]=> string(1) "a" [3]=> string(1) "b" [4]=> string(1) "z" [5]=> string(1) "w" }
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 array(6) { [0]=> int(0) [1]=> int(1) [2]=> int(2) [3]=> int(3) [4]=> int(4) [5]=> int(5) } array(6) { [0]=> string(1) "f" [1]=> string(1) "g" [2]=> string(1) "a" [3]=> string(1) "b" [4]=> string(1) "z" [5]=> string(1) "w" }
Output for 7.3.0 - 7.3.27, 7.4.0 - 7.4.16
Parse error: syntax error, unexpected ':', expecting ')' in /in/MEoCv on line 9
Process exited with code 255.

preferences:
81.66 ms | 402 KiB | 76 Q