3v4l.org

run code in 300+ PHP versions simultaneously
<?php function numbers($first, $second, ...$third) { // echo ($numbers['numbers'] ?? $numbers[0])[1]; var_dump(func_get_args()); echo '---------------' . PHP_EOL; var_dump($first, $second, $third); echo '-=-=-=-=-=-=-=' . PHP_EOL; } numbers(1, 2, [3, 4]); numbers(1, 2, numbers: [3, 4]); numbers(second: 2, first: 1, third: [3, 4]);
Output for 8.1.0 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
array(3) { [0]=> int(1) [1]=> int(2) [2]=> array(2) { [0]=> int(3) [1]=> int(4) } } --------------- int(1) int(2) array(1) { [0]=> array(2) { [0]=> int(3) [1]=> int(4) } } -=-=-=-=-=-=-= array(2) { [0]=> int(1) [1]=> int(2) } --------------- int(1) int(2) array(1) { ["numbers"]=> array(2) { [0]=> int(3) [1]=> int(4) } } -=-=-=-=-=-=-= array(2) { [0]=> int(1) [1]=> int(2) } --------------- int(1) int(2) array(1) { ["third"]=> array(2) { [0]=> int(3) [1]=> int(4) } } -=-=-=-=-=-=-=

preferences:
54.88 ms | 1043 KiB | 4 Q