3v4l.org

run code in 500+ PHP versions simultaneously
<?php function foo() { print_r(func_get_args()); } $array = [1,2,3]; // Not possible // cannot use positional argument after unpacking //foo(...$array, ...$array, 4); foo(...$array, ...$array, ...[4]);
Output for 8.2.31, 8.3.0 - 8.3.31, 8.4.1 - 8.4.22, 8.5.0 - 8.5.7
Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 1 [4] => 2 [5] => 3 [6] => 4 )

preferences:
51.37 ms | 733 KiB | 4 Q