public function splice(array $array, $offset, $length = 1, $replacements = null): array
    {
        $arguments = func_get_args();
        $replacements = array_slice($arguments, 3);
        array_splice($array, $offset, $length, $replacements);
        return $array;
    }
public function splice(array $array, $offset, $length = 1, $replacements = null): array
    {
        $arguments = func_get_args();
        $replacements = array_slice($arguments, 3);
        array_splice($array, $offset, $length, $replacements);
        return $array;
    }
public function splice ( array $ array , $ offset , $ length = 1 , $ replacements = null ) : array { $ arguments = func_get_args ( ) ; $ replacements = array_slice ( $ arguments , 3 ) ; array_splice ( $ array , $ offset , $ length , $ replacements ) ; return $ array ; }
Replaces a range of an array by the given replacements

Allows to give multiple replacements at once::

Array.splice(array, 3, 2, 'a', 'b')

@param array $array
@param int $offset Index of the first element to remove
@param int $length Number of elements to remove
@param mixed $replacements Elements to insert instead of the removed range
@return array The array with removed and replaced elements
Replaces a range of an array by the given replacements