Completed
Push — master ( 4f50ab...5be735 )
by Ondřej
03:27
created

varargs.php ➔ foo()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 3
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php
2
function foo($lead1, $lead2, ...$varArgs) // non-variable trailing arguments would lead to a parse error
3
{
4
	var_export($varArgs);
5
	echo "\n";
6
}
7
8
foo(...range(1, 5)); // prints [3, 4, 5]
9
foo(...[1 => 'a', 3 => 'b']); // prints []
10
foo(...[-2 => 'a', -1 => 'b', 0 => 'c', 1 => 'd']); // prints ['c', 'd']
11