1--TEST--
2Test array_merge() function : usage variations - position of internal array pointer
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 * Check the position of the internal array pointer after calling array_merge().
12 * This test is also passing more than two arguments to array_merge().
13 */
14
15echo "*** Testing array_merge() : usage variations ***\n";
16
17$arr1 = array ('zero', 'one', 'two');
18$arr2 = array ('zero', 'un', 'deux');
19$arr3 = array ('null', 'eins', 'zwei');
20
21echo "\n-- Call array_merge() --\n";
22var_dump($result = array_merge($arr1, $arr2, $arr3));
23
24echo "\n-- Position of Internal Pointer in Result: --\n";
25echo key($result) . " => " . current($result) . "\n";
26
27echo "\n-- Position of Internal Pointer in Original Array: --\n";
28echo "\$arr1: ";
29echo key($arr1) . " => " . current ($arr1) . "\n";
30echo "\$arr2: ";
31echo key($arr2) . " => " . current ($arr2) . "\n";
32echo "\$arr3: ";
33echo key($arr3) . " => " . current ($arr3) . "\n";
34
35echo "Done";
36?>
37
38--EXPECTF--
39*** Testing array_merge() : usage variations ***
40
41-- Call array_merge() --
42array(9) {
43  [0]=>
44  string(4) "zero"
45  [1]=>
46  string(3) "one"
47  [2]=>
48  string(3) "two"
49  [3]=>
50  string(4) "zero"
51  [4]=>
52  string(2) "un"
53  [5]=>
54  string(4) "deux"
55  [6]=>
56  string(4) "null"
57  [7]=>
58  string(4) "eins"
59  [8]=>
60  string(4) "zwei"
61}
62
63-- Position of Internal Pointer in Result: --
640 => zero
65
66-- Position of Internal Pointer in Original Array: --
67$arr1: 0 => zero
68$arr2: 0 => zero
69$arr3: 0 => null
70Done