← All docs

array_slice()

Extracts a slice of an array.

array_slice()

function array_slice(array $array, int $offset, int $length = null): array

Extracts a slice of an array.

Parameters:

  • $array (array)
  • $offset (int)
  • $length (int), default null, optional

Returns: array

No examples yet — check examples/ and showcases/ for usage patterns.

Internals

For how array_slice is implemented in the compiler, see the internals page.