array_chunk

Chunks an array into size large chunks

function array_chunk<Tv>(
  mixed $input,
  int $size,
  bool $preserve_keys = false,
): varray<Container<int>>;

The last chunk may contain less than size elements.

Parameters

  • mixed $input - The array to work on
  • int $size - The size of each chunk
  • bool $preserve_keys = false - When set to TRUE keys will be preserved. Default is FALSE which will reindex the chunk numerically

Returns

  • mixed - - Returns a multidimensional numerically indexed array, starting with zero, with each dimension containing size elements.