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 * Pass different data types as $length argument to array_slice to test behaviour
11 echo "*** Testing array_slice() : usage variations ***\n";
13 // Initialise function arguments not being substituted
14 $input_array = array('one' => 1, 2, 'three' => 3, 4);
17 //get an unset variable
26 // unexpected values to be passed to $length argument
63 /*22*/ @$undefined_var,
69 // loop through each element of $inputs to check the behavior of array_slice
71 foreach($inputs as $input) {
72 echo "\n-- Iteration $iterator --\n";
73 var_dump( array_slice($input_array, $offset, $input) );