PHP/Data Structure/array chunk

Материал из Web эксперт
Перейти к: навигация, поиск

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>