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