1--TEST-- 2Additional named params are collect into variadics 3--FILE-- 4<?php 5 6function test($a, string ...$extra) { 7 var_dump($a); 8 var_dump($extra); 9 // Extra named parameters do not contribute toward func_num_args() and func_get_args(). 10 var_dump(func_num_args()); 11 var_dump(func_get_args()); 12} 13 14function test2(&...$refs) { 15 foreach ($refs as &$ref) $ref++; 16} 17 18test(b: 'b', a: 'a', c: 'c', extra: 'extra'); 19echo "\n"; 20 21test('a', 'b', 'c', d: 'd'); 22echo "\n"; 23 24$x = 0; 25$y = 0; 26test2(x: $x, y: $y); 27var_dump($x, $y); 28 29?> 30--EXPECT-- 31string(1) "a" 32array(3) { 33 ["b"]=> 34 string(1) "b" 35 ["c"]=> 36 string(1) "c" 37 ["extra"]=> 38 string(5) "extra" 39} 40int(1) 41array(1) { 42 [0]=> 43 string(1) "a" 44} 45 46string(1) "a" 47array(3) { 48 [0]=> 49 string(1) "b" 50 [1]=> 51 string(1) "c" 52 ["d"]=> 53 string(1) "d" 54} 55int(3) 56array(3) { 57 [0]=> 58 string(1) "a" 59 [1]=> 60 string(1) "b" 61 [2]=> 62 string(1) "c" 63} 64 65int(1) 66int(1) 67