2 /* Prototype : array array_slice(array $input, int $offset [, int $length [, bool $preserve_keys]])
3 * Description: Returns elements specified by offset and length
4 * Source code: ext/standard/array.c
8 * Test array_slice() when:
9 * 1. Passed an array of referenced variables
10 * 2. $input argument is passed by reference
13 echo "*** Testing array_slice() : usage variations ***\n";
19 echo "\n-- Array of referenced variables (\$preserve_keys = default) --\n";
20 $input = array(3 => &$val1, 2 => &$val2, 1 => &$val3);
21 var_dump(array_slice($input, 1, 2));
23 echo "-- Change \$val2 (\$preserve_keys = TRUE) --\n";
24 $val2 = 'hello, world';
25 var_dump(array_slice($input, 1, 2, true));