note 18074 added to function.array-chunk

From: Date: Wed, 09 Jan 2002 20:05:00 +0000
Subject: note 18074 added to function.array-chunk
Groups: php.notes 
Request: Send a blank email to php-notes+get-24592@lists.php.net to get a copy of this message
Here is the function in PHP since it is only available in the CVS... -Jeff Nappi brage@brageproductions<DOT HERE>com function array_chunk ($a, $s, $p=false) { $r = Array(); $ak = array_keys($a); $i = 0; $sc = 0; for ($x=0;$x<count($ak);$x++) { if ($i == $s){$i = 0;$sc++;} $k = ($p) ? $ak[$x] : $i; $r[$sc][$k] = $a[$ak[$x]]; $i++; } return $r; } -- http://www.php.net/manual/en/function.array-chunk.php http://master.php.net/manage/user-notes.php?action=edit+18074 http://master.php.net/manage/user-notes.php?action=delete+18074 http://master.php.net/manage/user-notes.php?action=reject+18074

« previous php.notes (#24592) next »