Arrayarray_slice (array $ array, int $ offset [, int $ lengthNULL [, bool $ preserve_keysfalse]) function: extracts a subarray sequence from an array. Description: array_slice () is returned based on offset and leng.
array array_slice ( array $array , int $offset [, int $length = NULL [, bool $preserve_keys = false ]] )
Function:Extracts a subarray sequence from the array.
Description:Array_slice () returns a sequence in the array specified by the offset and length parameters.
Parameters:
array
Input array.
offset
If?offset? If it is not negative, the sequence will start from?array? The offset in. If?offset? If it is negative, the sequence will start from?array? Starting from a place so far from the end.
length
If yes?length? If it is positive, the sequence will have so many units. If yes?length? If it is negative, the sequence is terminated so far from the end of the array. If this parameter is omitted, the sequence starts from?offset? Start till?array? .
preserve_keys
Note? Array_slice ()? By default, the array's numeric indexes are re-sorted and reset. You can?preserve_keys? Set?TRUE? To change this behavior.
Return value:Returns the subarray sequence.
Example:
Output result:
Array( [0] => a [1] => b)Array( [0] => c [1] => d [2] => e)Array( [2] => c [3] => d [4] => e)