Name
array_slice
Synopsis
array array_slice(arrayarray, intoffset[, intlength][, boolkeepkeys])
Returns an array containing a set of elements pulled from the
given array. If offset is a positive
number, elements starting from that index onward are used; if
offset is a negative number, elements
starting that many elements from the end of the array are used. If the
third argument is provided and is a positive number, that many
elements are returned; if negative, the sequence stops that many
elements from the end of the array. If the third argument is omitted,
the sequence returned contains all elements from the offset to the end
of the array. If keepkeys, the
fourth argument, is true, then the
order of numeric keys will be preserved; otherwise they will be
renumbered and resorted.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access