shuffle

shuffle -- Shuffle an array

Description

void shuffle(array array);

This function shuffles (randomizes the order of the elements in) an array.

Example 1. shuffle() example

  1 
  2 $numbers = range (1,20);
  3 srand (time());
  4 shuffle ($numbers);
  5 while (list(, $number) = each ($numbers)) {
  6     echo "$number ";
  7 }
  8       

See also arsort(), asort(), ksort(), rsort(), sort() and usort().