import zend standard tests
[hiphop-php.git] / hphp / test / zend / bad / ext-standard-array / array_slice_variation6.php
blob77d19b4b16c5a913e1c14e3109fc3f1eef1aff93
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 * Pass different integer values as $length argument to array_slice() to test behaviour
9 */
11 echo "*** Testing array_slice() : usage variations ***\n";
13 $input = array ('one' => 1, 2 => 'two', 'three', 9 => 'nine', 'ten' => 10);
14 $offset = 1;
16 for ($i = -6; $i <= 6; $i++) {
17 echo "\n-- \$length is $i --\n";
18 var_dump(array_slice($input, $offset, $i));
20 echo "\n-- \$length is maximum integer value --\n";
21 var_dump(array_slice($input, $offset, PHP_INT_MAX));
23 echo "\n-- \$length is minimum integer value --\n";
24 var_dump(array_slice($input, $offset, -PHP_INT_MAX));
26 echo "Done";