note 83752 added to function.array-chunk
| From: | OIS at osu1 dot php dot net | Date: | Tue, 10 Jun 2008 12:31:51 +0000 |
| Subject: | note 83752 added to function.array-chunk | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-140303@lists.php.net to get a copy of this message | ||
Response to azspot at gmail dot com function partition.
$columns = 3;
$citylist = array('Black Canyon City', 'Chandler', 'Flagstaff',
'Gilbert', 'Glendale', 'Globe', 'Mesa', 'Miami',
'Phoenix', 'Peoria', 'Prescott', 'Scottsdale', 'Sun
City', 'Surprise', 'Tempe', 'Tucson', 'Wickenburg');
print_r(array_chunk($citylist, ceil(count($citylist) / $columns)));
Output:
Array
(
[0] => Array
(
[0] => Black Canyon City
[1] => Chandler
[2] => Flagstaff
[3] => Gilbert
[4] => Glendale
[5] => Globe
)
[1] => Array
(
[0] => Mesa
[1] => Miami
[2] => Phoenix
[3] => Peoria
[4] => Prescott
[5] => Scottsdale
)
[2] => Array
(
[0] => Sun City
[1] => Surprise
[2] => Tempe
[3] => Tucson
[4] => Wickenburg
)
)
----
Server IP: 62.73.196.231
Probable Submitter: 194.29.203.198
----
Manual Page -- http://www.php.net/manual/en/function.array-chunk.php
Edit -- https://master.php.net/note/edit/83752
Del: integrated -- https://master.php.net/note/delete/83752/integrated
Del: useless -- https://master.php.net/note/delete/83752/useless
Del: bad code -- https://master.php.net/note/delete/83752/bad+code
Del: spam -- https://master.php.net/note/delete/83752/spam
Del: non-english -- https://master.php.net/note/delete/83752/non-english
Del: in docs -- https://master.php.net/note/delete/83752/in+docs
Del: other reasons-- https://master.php.net/note/delete/83752
Reject -- https://master.php.net/note/reject/83752
Search -- https://master.php.net/manage/user-notes.php