shuffle

(PHP3 >= 3.0.8, PHP4 >= 4.0b4)

shuffle -- Shuffle an array

Description

void shuffle (array array)

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

Példa 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().