The What
Syntax
array array_slice ( array $target_array, int $offset, [, int $length = NULL [, bool $preserve_keys = false]] );
Description
This construct, array_slice
, extracts a range of elements out of the target array based upon the parameters that you give it.
Parameters
target_array
- The array from which to remove the range of elements.
offset
- Specifies the element index (by the array pointer) where to start the slice If the offset is negative, it starts at the element from the end of the array; else the offset starts from index zero to where it is specified.
length
- optional Specify how many elements you want.
preserve_keys
- optional When set to
TRUE
, the array’s keys will be preserved; else, the keys will be reindexed and re-ordered.
Return Values
Returns a new array with the range of elements you specified.
Hey... hey you... yes you!... Having a good time? Learning new things? Good!
More coming soon…keep checking back.