3v4l.org

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

preferences:
28.31 ms | 1497 KiB | 7 Q