PHP array shuffle
Written by Administrator   
sabato, 30 maggio 2009

The code here below shows how to shuffle a php array: the script creates a 20 element array and prints out its content after having modified the element order.

$nrs = range(1, 20);
srand((float)microtime() * 1000000);
shuffle($nrs);
while (list(, $nr) = each($nrs)) {
  echo "$nr ";
}

Last Updated ( sabato, 30 maggio 2009 )