shuffle

(PHP 3>= 3.0.8, PHP 4 )

shuffle -- 将数组打乱

说明

void shuffle ( array array)

本函数打乱(随机排列单元的顺序)一个数组。必须用 srand() 播下本函数的随机数发生器种子。

例子 1. shuffle() 例子

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

参见 arsort()asort()ksort()rsort()sort()usort()