1--TEST-- 2Named args after unpacking (supported) 3--FILE-- 4<?php 5 6function test(...$args) { 7 var_dump($args); 8} 9 10test(...[1, 2], a: 3); 11test(...[1, 'a' => 2], b: 3); 12 13function test2($a, $b, $c = 3, $d = 4) { 14 var_dump($a, $b, $c, $d); 15} 16 17test2(...[1, 2], d: 40); 18test2(...['b' => 2, 'a' => 1], d: 40); 19 20try { 21 test2(...[1, 2], b: 20); 22} catch (Error $e) { 23 echo $e->getMessage(), "\n"; 24} 25try { 26 test2(...[1, 'b' => 2], b: 20); 27} catch (Error $e) { 28 echo $e->getMessage(), "\n"; 29} 30 31?> 32--EXPECT-- 33array(3) { 34 [0]=> 35 int(1) 36 [1]=> 37 int(2) 38 ["a"]=> 39 int(3) 40} 41array(3) { 42 [0]=> 43 int(1) 44 ["a"]=> 45 int(2) 46 ["b"]=> 47 int(3) 48} 49int(1) 50int(2) 51int(3) 52int(40) 53int(1) 54int(2) 55int(3) 56int(40) 57Named parameter $b overwrites previous argument 58Named parameter $b overwrites previous argument 59