Annotation of embedaddon/php/ext/standard/tests/array/array_merge_variation5.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test array_merge() function : usage variations - numeric keys
3: --FILE--
4: <?php
5: /* Prototype : array array_merge(array $arr1, array $arr2 [, array $...])
6: * Description: Merges elements from passed arrays into one array
7: * Source code: ext/standard/array.c
8: */
9:
10: /*
11: * Pass array_merge() arrays with only numeric keys to test behaviour.
12: * $arr2 contains a duplicate element to $arr1.
13: */
14:
15: echo "*** Testing array_merge() : usage variations ***\n";
16:
17: //numeric keys
18: $arr1 = array('zero', 'one', 'two', 'three');
19: $arr2 = array(1 => 'one', 20 => 'twenty', 30 => 'thirty');
20:
21: var_dump(array_merge($arr1, $arr2));
22: var_dump(array_merge($arr2, $arr1));
23:
24: echo "Done";
25: ?>
26:
27: --EXPECTF--
28: *** Testing array_merge() : usage variations ***
29: array(7) {
30: [0]=>
31: string(4) "zero"
32: [1]=>
33: string(3) "one"
34: [2]=>
35: string(3) "two"
36: [3]=>
37: string(5) "three"
38: [4]=>
39: string(3) "one"
40: [5]=>
41: string(6) "twenty"
42: [6]=>
43: string(6) "thirty"
44: }
45: array(7) {
46: [0]=>
47: string(3) "one"
48: [1]=>
49: string(6) "twenty"
50: [2]=>
51: string(6) "thirty"
52: [3]=>
53: string(4) "zero"
54: [4]=>
55: string(3) "one"
56: [5]=>
57: string(3) "two"
58: [6]=>
59: string(5) "three"
60: }
61: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>