array_chunk in php

To divide an array into smaller, evenly sized arrays, use the array_chunk() function: $chunks = array_chunk(array, size [, preserve_keys]); The function returns an array of the smaller arrays. The third argument, pre serve_keys, is a Boolean value that determines whether the elements of the new arrays have the same keys as in the original (useful … Read more