Skip to content

Commit 18cae3c

Browse files
committed
Add test for call_user_func_array() behavior
1 parent 14531b0 commit 18cae3c

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
--TEST--
2+
Behavior of call_user_func_array() with named parameters
3+
--FILE--
4+
<?php
5+
6+
function test($a, $b) {
7+
var_dump($a, $b);
8+
}
9+
10+
// Keys are ignored by call_user_func_array().
11+
// Use "..." if you want named params support!
12+
13+
call_user_func_array('test', [0 => 'a', 1 => 'b']);
14+
call_user_func_array('test', [1 => 'a', 0 => 'b']);
15+
call_user_func_array('test', ['b' => 'a', 'a' => 'b']);
16+
call_user_func_array('test', ['c' => 'a', 'd' => 'b']);
17+
18+
?>
19+
--EXPECT--
20+
string(1) "a"
21+
string(1) "b"
22+
string(1) "a"
23+
string(1) "b"
24+
string(1) "a"
25+
string(1) "b"
26+
string(1) "a"
27+
string(1) "b"

0 commit comments

Comments
 (0)