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

Array shuffle

Tue Oct 28, 2008 1:15 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 : Array shuffle
 Shuffle Array     -  
 Array difference for associate array     -  
 compare an array with another array?     -  
 Average of an array. Please help     -  
 Imploding an Array     -  
 Get array chunk     -  
 Array sort     -  
 Array size to zero     -  
 C++ array copying     -  
 Add elements to the end of an array     -  

Topic Tags

PHP Arrays