blob: 8483a00339bc11eec2383c1491b27a21a4874bc0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
--TEST--
Test array_merge() function : usage variations - string keys
--FILE--
<?php
/* Prototype : array array_merge(array $arr1, array $arr2 [, array $...])
* Description: Merges elements from passed arrays into one array
* Source code: ext/standard/array.c
*/
/*
* Pass array_merge arrays with string keys to test behaviour.
* $arr2 has a duplicate key to $arr1
*/
echo "*** Testing array_merge() : usage variations ***\n";
//string keys
$arr1 = array('zero' => 'zero', 'one' => 'un', 'two' => 'deux');
$arr2 = array('zero' => 'zero', 'un' => 'eins', 'deux' => 'zwei');
var_dump(array_merge($arr1, $arr2));
var_dump(array_merge($arr2, $arr1));
echo "Done";
?>
--EXPECT--
*** Testing array_merge() : usage variations ***
array(5) {
["zero"]=>
string(4) "zero"
["one"]=>
string(2) "un"
["two"]=>
string(4) "deux"
["un"]=>
string(4) "eins"
["deux"]=>
string(4) "zwei"
}
array(5) {
["zero"]=>
string(4) "zero"
["un"]=>
string(4) "eins"
["deux"]=>
string(4) "zwei"
["one"]=>
string(2) "un"
["two"]=>
string(4) "deux"
}
Done
|