PHP Manual
/
Field

PHP function array_splice()

11. 09. 2019

Obsah článku

Availability in `PHP 4.0`

Remove a portion of the array and replace it with something else

Parameters

Parameter Data type Default value Note
$input array not The input array.
$offset int not If offset is positive then the start of removed portion is at that offset from the beginning of the input array. If offset is negative then it starts that far from the end of the input array.
$length int null, 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. Tip: to remove everything from offset to the end of the array when replacement is also specified, use count($input) for length.
$replacement mixed null If replacement array is specified, then the removed elements are replaced with elements from this array.

Return values

array

the array consisting of the extracted elements.

Additional resources

Official documentation of the array-splice function

Jan Barášek   Více o autorovi

Autor článku pracuje jako seniorní vývojář a software architekt v Praze. Navrhuje a spravuje velké webové aplikace, které znáte a používáte. Od roku 2009 nabral bohaté zkušenosti, které tímto webem předává dál.

Rád vám pomůžu:

Související články

1.
9.

V jiných jazycích

Status:
All systems normal.
2024