运行 ❯
获取你的
自己的 PHP
服务器
×
更改方向
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <body> <?php $my_array = array("a"=>"red","b"=>"green","c"=>"blue","d"=>"yellow","e"=>"purple"); shuffle($my_array); print_r($my_array); ?> <p>Refresh the page to see how shuffle() randomizes the order of the elements in the array.</p> </body> </html>
Array ( [0] => red [1] => yellow [2] => green [3] => purple [4] => blue )
刷新页面以查看 shuffle() 如何随机化数组中元素的顺序。