[int|null$length = null],
[mixed$replacement = ]
Removes the elements designated by offset and length from the array array, and replaces them with the elements of the replacement array, if supplied.
Numerical keys in array are not preserved.
If replacement is not an array, it will be
to one (i.e.
(array) $replacement). This may result in unexpected
behavior when using an object or null replacement.
The input array.
If offset is positive then the start of the removed portion is at that offset from the beginning of the array array.
If offset is negative then the start of the removed portion is at that offset from the end of the array array.
If length is omitted, removes everything from offset to the end of the array.
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 of the array.
If length is specified and is zero, no elements will be removed.
To remove everything from offset to the end of the array when replacement is also specified, use
If replacement array is specified, then the removed elements are replaced with elements from this array.
If offset and length are such that nothing is removed, then the elements from the replacement array are inserted in the place specified by the offset.
Keys in the replacement array are not preserved.
If replacement is just one element it is not necessary to put array() or square brackets around it, unless the element is an array itself, an object or null.
Returns an array consisting of the extracted elements.
|8.0.0||length is nullable now.|