3v4l.org

run code in 300+ PHP versions simultaneously
<?php function variadic(string $a, ...$b) { printf( "--------------%d---------------\n", func_num_args()); var_dump(func_get_args()); var_dump($a, $b); printf("------------------------------\n\n"); } variadic("a", ["things", "things2"]); variadic(a: "a", b: ["things", "things2"]);
Output for 8.0.0 - 8.0.3, 8.1.23 - 8.1.34, 8.2.10 - 8.2.30, 8.3.0 - 8.3.4, 8.3.6 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
--------------2--------------- array(2) { [0]=> string(1) "a" [1]=> array(2) { [0]=> string(6) "things" [1]=> string(7) "things2" } } string(1) "a" array(1) { [0]=> array(2) { [0]=> string(6) "things" [1]=> string(7) "things2" } } ------------------------------ --------------1--------------- array(1) { [0]=> string(1) "a" } string(1) "a" array(1) { ["b"]=> array(2) { [0]=> string(6) "things" [1]=> string(7) "things2" } } ------------------------------
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 --------------2--------------- array(2) { [0]=> string(1) "a" [1]=> array(2) { [0]=> string(6) "things" [1]=> string(7) "things2" } } string(1) "a" array(1) { [0]=> array(2) { [0]=> string(6) "things" [1]=> string(7) "things2" } } ------------------------------ --------------1--------------- array(1) { [0]=> string(1) "a" } string(1) "a" array(1) { ["b"]=> array(2) { [0]=> string(6) "things" [1]=> string(7) "things2" } } ------------------------------
Output for 7.3.0 - 7.3.27, 7.4.0 - 7.4.16
Parse error: syntax error, unexpected ':', expecting ')' in /in/kr4KI on line 12
Process exited with code 255.

preferences:
71.07 ms | 1106 KiB | 4 Q