Shuffle an array in PHP

前端 未结 6 1719
悲&欢浪女
悲&欢浪女 2020-12-02 00:39

I have the following code:

image . \";
echo($url);
endforeach;
?>
6条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-02 01:19

    shuffle($array_name); // will shuffle array
    

    http://www.php.net/manual/en/function.shuffle.php

    Also the foreach should be

    for($array_name as $array_item) {
    // do stuff
    }
    

提交回复
热议问题