public function slice($offset, $length = null, $preserveKeys = false, $asArray = false)
    {
        if (!is_int($offset)) {
            throw new InvalidArgumentException('integer', 0);
        }
        if (!is_null($length) && !is_int($length)) {
            throw new InvalidArgumentException('integer', 1);
        }
        $preserveKeys = !!$preserveKeys;

        $array = $this->getArrayCopy();
        $newArray = array_slice($array, $offset, $length, $preserveKeys);
        return (!!$asArray) ? $newArray : new self($newArray);
    }
public function slice($offset, $length = null, $preserveKeys = false, $asArray = false)
    {
        if (!is_int($offset)) {
            throw new InvalidArgumentException('integer', 0);
        }
        if (!is_null($length) && !is_int($length)) {
            throw new InvalidArgumentException('integer', 1);
        }
        $preserveKeys = !!$preserveKeys;

        $array = $this->getArrayCopy();
        $newArray = array_slice($array, $offset, $length, $preserveKeys);
        return (!!$asArray) ? $newArray : new self($newArray);
    }
public function slice ( $ offset , $ length = null , $ preserveKeys = false , $ asArray = false ) { if ( ! is_int ( $ offset ) ) { throw new InvalidArgumentException ( 'integer' , 0 ) ; } if ( ! is_null ( $ length ) && ! is_int ( $ length ) ) { throw new InvalidArgumentException ( 'integer' , 1 ) ; } $ preserveKeys = ! ! $ preserveKeys ; $ array = $ this -> getArrayCopy ( ) ; $ newArray = array_slice ( $ array , $ offset , $ length , $ preserveKeys ) ; return ( ! ! $ asArray ) ? $ newArray : new self ( $ newArray ) ; }
Returns the sequence of elements as specified by the offset and length parameters.

@param int $offset [required] If offset is non-negative, the sequence will start at that offset.
If offset is negative, the sequence will start that far from the end of the
array.
@param int $length [optional] If length is given and is positive, then the sequence will have up to that
many elements in it. If the array is shorter than the length, then only the
available array elements will be present. If length is given and is negative
then the sequence will stop that many elements from the end of the array.
If it is omitted, then the sequence will have everything from offset up until
the end of the array.
@param bool $preserveKeys [optional] Note that arraySlice() will reorder and reset the numeric array indices by
default. You can change this behaviour by setting preserveKeys to TRUE.
@param bool $asArray [optional] By default, slice() returns a new instance of HtaccessContainer object.
If you prefer a basic array instead, set asArray to true
@return array                        Returns the slice.
@throws InvalidArgumentException
Returns the sequence of elements as specified by the offset and length parameters .