← All docs

array_chunk()

Splits an array into chunks of the given size.

array_chunk()

function array_chunk(array $array, int $length, bool $preserve_keys = false): array

Splits an array into chunks of the given size.

Parameters:

  • $array (array)
  • $length (int)
  • $preserve_keys (bool), default false, optional

Returns: array

Availability

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

Internals

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