1--TEST-- 2Test array_slice() function : basic functionality 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 * Test basic functionality of array_slice() 12 */ 13 14echo "*** Testing array_slice() : basic functionality ***\n"; 15 16 17$input = array('one' => 1, 'two' => 2, 3, 23 => 4); 18$offset = 2; 19$length = 2; 20$preserve_keys = true; 21 22// Calling array_slice() with all possible arguments 23echo "\n-- All arguments --\n"; 24var_dump( array_slice($input, $offset, $length, $preserve_keys) ); 25 26// Calling array_slice() with mandatory arguments 27echo "\n-- Mandatory arguments --\n"; 28var_dump( array_slice($input, $offset) ); 29 30echo "Done"; 31?> 32 33--EXPECTF-- 34*** Testing array_slice() : basic functionality *** 35 36-- All arguments -- 37array(2) { 38 [0]=> 39 int(3) 40 [23]=> 41 int(4) 42} 43 44-- Mandatory arguments -- 45array(2) { 46 [0]=> 47 int(3) 48 [1]=> 49 int(4) 50} 51Done