Skip to content

Commit 14531b0

Browse files
committed
Add test for func_get_args() with named params
This works out of the box
1 parent 7444fdd commit 14531b0

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
--TEST--
2+
Behavior of func_get_args() and friends with named parameters
3+
--FILE--
4+
<?php
5+
6+
function test($a, $b = 'b', $c = 'c') {
7+
var_dump(func_num_args());
8+
var_dump(func_get_args());
9+
var_dump(func_get_arg(0));
10+
var_dump(func_get_arg(1));
11+
var_dump(func_get_arg(2));
12+
}
13+
14+
test(c: 'C', a: 'A');
15+
16+
?>
17+
--EXPECT--
18+
int(3)
19+
array(3) {
20+
[0]=>
21+
string(1) "A"
22+
[1]=>
23+
string(1) "b"
24+
[2]=>
25+
string(1) "C"
26+
}
27+
string(1) "A"
28+
string(1) "b"
29+
string(1) "C"

0 commit comments

Comments
 (0)