note 45870 added to function.array-chunk
| From: | MarkEl-Wakilmarkatseventhcyclednet at osu1 dot php dot net | Date: | Wed, 22 Sep 2004 04:16:59 +0000 |
| Subject: | note 45870 added to function.array-chunk | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-77138@lists.php.net to get a copy of this message | ||
If you want to split an array into x number of arrays (instead of multiple arrays of x size), this
function should do the trick:
function array_bigchunk($arr, $num)
{
return array_chunk($arr, ceil(sizeof($arr) / $num));
}
It's a small function that ends up doing what some people may have thought array_chunk would
have done.
----
Manual Page -- http://www.php.net/manual/en/function.array-chunk.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+45870
Delete -- http://master.php.net/manage/user-notes.php?action=delete+45870&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+45870&report=yes
Search -- http://master.php.net/manage/user-notes.php