Switch to full style
:read: Start PHP with us. Includes topics to help you in php
Post a reply

Get array chunk

Tue Oct 28, 2008 1:27 am

Code:
<?php
   $cards
= array("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P");
   
// shuffle the cards
   
print_r($cards);
   
   print
"<BR><BR><BR>";   
   
shuffle($cards);
   
// Use array_chunk() to divide the cards into four equal "hands"
   
$hands = array_chunk($cards, 4);
   
print_r($hands);
?>




Post a reply
  Related Posts  to : Get array chunk
 Array difference for associate array     -  
 compare an array with another array?     -  
 Array sort     -  
 Array size to zero     -  
 C++ array copying     -  
 Add elements to the end of an array     -  
 Pad array to the specified length with a value     -  
 Array C++ Class     -  
 XML Document into an Array in php     -  
 Shuffle Array     -  

Topic Tags

PHP Arrays