public function splice($offset, $length = null, $replacement = array())
    {
        if (!is_int($offset)) {
            throw new InvalidArgumentException('integer', 0);
        }
        if (!is_null($length) && !is_int($length)) {
            throw new InvalidArgumentException('integer', 1);
        }
        if (!is_array($replacement) && !$replacement instanceof \ArrayAccess) {
            throw new InvalidArgumentException('integer', 2);
        }

        $array = $this->getArrayCopy();
        $spliced = array_splice($array, $offset, $length, $replacement);
        $this->exchangeArray($array);
        return $spliced;
    }
public function splice($offset, $length = null, $replacement = array())
    {
        if (!is_int($offset)) {
            throw new InvalidArgumentException('integer', 0);
        }
        if (!is_null($length) && !is_int($length)) {
            throw new InvalidArgumentException('integer', 1);
        }
        if (!is_array($replacement) && !$replacement instanceof \ArrayAccess) {
            throw new InvalidArgumentException('integer', 2);
        }

        $array = $this->getArrayCopy();
        $spliced = array_splice($array, $offset, $length, $replacement);
        $this->exchangeArray($array);
        return $spliced;
    }
public function splice ( $ offset , $ length = null , $ replacement = array ( ) ) { if ( ! is_int ( $ offset ) ) { throw new InvalidArgumentException ( 'integer' , 0 ) ; } if ( ! is_null ( $ length ) && ! is_int ( $ length ) ) { throw new InvalidArgumentException ( 'integer' , 1 ) ; } if ( ! is_array ( $ replacement ) && ! $ replacement instanceof \ ArrayAccess ) { throw new InvalidArgumentException ( 'integer' , 2 ) ; } $ array = $ this -> getArrayCopy ( ) ; $ spliced = array_splice ( $ array , $ offset , $ length , $ replacement ) ; $ this -> exchangeArray ( $ array ) ; return $ spliced ; }
Removes the elements designated by offset and length, and replaces them with the elements of the replacement
array, if supplied.

@param int $offset [required] If offset is positive then the start of removed portion is at that offset
from the beginning. If offset is negative then it starts that far from the
end of the input array.
@param int $length [optional] If length is omitted, removes everything from offset to the end. If length
is specified and is positive, then that many elements will be removed.
If length is specified and is negative then the end of the removed portion
will be that many elements from the end.
Tip: to remove everything from offset to the end of the array when
replacement is also specified, use count($input) for length.
@param array|\ArrayAccess $replacement [optional] If replacement array is specified, then the removed elements
are replaced with elements from this array.

@return array                 Returns the array consisting of the extracted elements.
@throws InvalidArgumentException
Removes the elements designated by offset and length and replaces them with the elements of the replacement array if supplied .