1--TEST-- 2Test array_slice() function : usage variations - position of internal array pointer 3--FILE-- 4<?php 5/* Prototype : array array_slice(array $input, int $offset [, int $length [, bool $preserve_keys]]) 6 * Description: Returns elements specified by offset and length 7 * Source code: ext/standard/array.c 8 */ 9 10/* 11 * Check position of internal array pointer after calling array_slice() 12 */ 13 14echo "*** Testing array_slice() : usage variations ***\n"; 15 16$input = array ('one' => 'un', 'two' => 'deux', 23 => 'twenty-three', 'zero'); 17 18echo "\n-- Call array_slice() --\n"; 19var_dump($result = array_slice($input, 2)); 20 21echo "-- Position of Internal Pointer in Result: --\n"; 22echo key($result) . " => " . current($result) . "\n"; 23echo "\n-- Position of Internal Pointer in Original Array: --\n"; 24echo key($input) . " => " . current ($input) . "\n"; 25 26echo "Done"; 27?> 28--EXPECT-- 29*** Testing array_slice() : usage variations *** 30 31-- Call array_slice() -- 32array(2) { 33 [0]=> 34 string(12) "twenty-three" 35 [1]=> 36 string(4) "zero" 37} 38-- Position of Internal Pointer in Result: -- 390 => twenty-three 40 41-- Position of Internal Pointer in Original Array: -- 42one => un 43Done 44