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

$numbers = range(1,20);
srand(time());
shuffle($numbers);
while (list(,$number) = each($numbers)) {
  echo "$number ";
}

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