import zend standard tests
[hiphop-php.git] / hphp / test / zend / good / ext-standard-array / array_slice_variation9.php
blobc6cfddf48e265efaa19ebdec8203cca4dd6fd628
1 <?php
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
5 */
7 /*
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";
15 $val1 = 'one';
16 $val2 = 'two';
17 $val3 = 'three';
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));
27 echo "Done";