PHP array_chunk() Function

PHP array_chunk() Function


PHP array_chunk() Function
The array_chunk() function splits an array into chunks of new arrays.
Syntax

    array_chunk(array, size, preserve_key)

Parameter Values :
Parameter Description
array Required. Specifies the array to use
size Required. An integer that specifies the size of each chunk
preserve_key Optional. Possible values:
  • true - Preserves the keys
  • false - Default. Reindexes the chunk numerically

 

Example :

Another Example :