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--EXPECT--
29*** Testing array_slice() : usage variations ***
30
31-- Slice a two-dimensional array --
32array(3) {
33  [0]=>
34  string(3) "one"
35  [1]=>
36  array(3) {
37    [0]=>
38    string(4) "zero"
39    [1]=>
40    string(2) "un"
41    [2]=>
42    string(4) "deux"
43  }
44  [2]=>
45  string(4) "nine"
46}
47
48-- $input is a sub-array --
49array(2) {
50  [0]=>
51  string(2) "un"
52  [1]=>
53  string(4) "deux"
54}
55Done
56