spacer.png, 0 kB
spacer.png, 0 kB
Home arrow PHP arrow PHP array shuffle
PHP array shuffle PDF Print E-mail
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 )
 
< Prev   Next >
spacer.png, 0 kB
spacer.png, 0 kB
spacer.png, 0 kB