PHP array_chunk() is an inbuilt function that splits the array into chunks of new arrays. The array_chunk() returns the multidimensional indexed array, starting with index zero, with each dimension containing size elements. I am using PHP version 7.2.14 for this example. The last chunk may contain less than size elements.
The syntax of array_chunk() function is following.
array_chunk(array,size,preserve_key);
An array parameter is required which specifies an array to use.
The size parameter is required which is an integer that specifies the size of the chunk.
The preserve_key parameter is optional. Possible values.
#php #php array_chunk