Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Remove a portion of the array and replace it with something else
<?php array_splice(    array &$array,    int $offset,    ?int $length = null,    mixed $replacement = []): array
<?php     public function splice($offset, $length = null, $replacement = [])

    {

        if (func_num_args() === 1) {

            return new static(array_splice($this->items, $offset));

        }



        return new static(array_splice($this->items, $offset, $length, $this->getArrayableItems($replacement)));
<?php             return new static(array_splice($this->items, $offset));

        }



        return new static(array_splice($this->items, $offset, $length, $this->getArrayableItems($replacement)));

    }
<?php     {

        $row = array_values(Arr::except($failed, ['payload', 'exception']));



        array_splice($row, 3, 0, $this->extractJobName($failed['payload']) ?: '');



        return $row;

    }
<?php     protected function spliceIntoParameters(array &$parameters, $offset, $value)

    {

        array_splice(

            $parameters, $offset, 0, [$value]

        );

    }

}
<?php     protected function moveMiddleware($middlewares, $from, $to)

    {

        array_splice($middlewares, $to, 0, $middlewares[$from]);



        unset($middlewares[$from + 1]);