PHP/Data Structure/array chunk — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Версия 13:37, 26 мая 2010
array_chunk
<source lang="html4strict">
<?php $cards = array("jh","js","jd","jc","qh","qs","qd"); // shuffle the cards shuffle($cards); // Use array_chunk() to divide the cards into four equal "hands" $hands = array_chunk($cards, 4); print_r($hands); ?>
</source>