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--EXPECTF-- 38*** Testing array_merge() : usage variations *** 39 40-- Call array_merge() -- 41array(9) { 42 [0]=> 43 string(4) "zero" 44 [1]=> 45 string(3) "one" 46 [2]=> 47 string(3) "two" 48 [3]=> 49 string(4) "zero" 50 [4]=> 51 string(2) "un" 52 [5]=> 53 string(4) "deux" 54 [6]=> 55 string(4) "null" 56 [7]=> 57 string(4) "eins" 58 [8]=> 59 string(4) "zwei" 60} 61 62-- Position of Internal Pointer in Result: -- 630 => zero 64 65-- Position of Internal Pointer in Original Array: -- 66$arr1: 0 => zero 67$arr2: 0 => zero 68$arr3: 0 => null 69Done 70