1--TEST-- 2Test array_slice() function : usage variations - multidimensional arrays 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 array_slice when passed 12 * 1. a two-dimensional array as $input argument 13 * 2. a sub-array as $input argument 14 */ 15 16echo "*** Testing array_slice() : usage variations ***\n"; 17 18$input = array ('zero', 'one', array('zero', 'un', 'deux'), 9 => 'nine'); 19 20echo "\n-- Slice a two-dimensional array --\n"; 21var_dump(array_slice($input, 1, 3)); 22 23echo "\n-- \$input is a sub-array --\n"; 24var_dump(array_slice($input[2], 1, 2)); 25 26echo "Done"; 27?> 28 29--EXPECTF-- 30*** Testing array_slice() : usage variations *** 31 32-- Slice a two-dimensional array -- 33array(3) { 34 [0]=> 35 string(3) "one" 36 [1]=> 37 array(3) { 38 [0]=> 39 string(4) "zero" 40 [1]=> 41 string(2) "un" 42 [2]=> 43 string(4) "deux" 44 } 45 [2]=> 46 string(4) "nine" 47} 48 49-- $input is a sub-array -- 50array(2) { 51 [0]=> 52 string(2) "un" 53 [1]=> 54 string(4) "deux" 55} 56Done