執行 ❯
獲取您
自己的 PHP
伺服器
×
更改方向
更改主題,深色/淺色
前往 Spaces
<!DOCTYPE html> <html> <body> <?php $my_array = array("red","green","blue","yellow","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>
陣列 ( [0] => 黃色 [1] => 紫色 [2] => 紅色 [3] => 藍色 [4] => 綠色 )
重新整理頁面,檢視 shuffle() 如何隨機化陣列中元素的順序。