PHP 打乱数组

$arr = array(
    array(
        "id"=>1,
        "name"=>"张三",
        "sex"=>"男",
        "age"=>22
    ),
    array(
        "id"=>3,
        "name"=>"李萍",
        "sex"=>"女",
        "age"=>18
    ),
    array(
        "id"=>4,
        "name"=>"黄山",
        "sex"=>"男",
        "age"=>12
    ),
    array(
        "id"=>5,
        "name"=>"何妹梅",
        "sex"=>"女",
        "age"=>32
    ),    
    array(
        "id"=>6,
        "name"=>"汤大丰",
        "sex"=>"男",
        "age"=>35
    )
);

print_r($arr);

shuffle($arr);
echo "<br/>排序后<br/>";
print_r($arr);
die;

 

posted @ 2016-12-02 09:56  麦田守望者~  阅读(7521)  评论(0编辑  收藏  举报