Break an array into different arrays containing x elements each
If I have a single array that has around 5000 elements.
I want 50 arrays out it having 100 elements each. And of course if there are 4923 elements, out of the 50 arrays, there will be 23 in the last one.
I know there must开发者_如何学Go be some built-in function for this. But can't get around one.
It is http://ru2.php.net/array_chunk
$splitted = array_chunk($my_array, 100);
精彩评论