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?     -  
 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     -  
 Pop the element off the end of array     -  
 Here is how to display any 2d array     -  

Topic Tags

PHP Arrays