PHP array_splice() Function

The array_splice() function removes selected elements from an array and replaces it with new elements. The function also returns an array with the removed elements.This function removes the elements designated by offset and length from the input array, and replaces them with the elements of the replacement array, if supplied. It returns an array containing the extracted elements.

Example -

Example -