1
我想要做一個測驗,在這裏不正常工作是我的數組:洗牌()作爲一個關聯數組
$questions = array("1+1"=>2,"5+2"=>7,"5+9"=>14,"3+5"=>8,"4+6"=>10,"1+8"=>9,"2+7"=>9,
"6+7"=>13,"9+3"=>12,"8+2"=>10,"5+5"=>10,"6+8"=>14,"9+4"=>13,"7+8"=>15,
"8+9"=>17,"4+8"=>12,"7+1"=>8,"6+3"=>9,"2+5"=>7,"3+4"=>7);
shuffle($questions);
foreach($questions as $key => $value) {
echo $key.' ';
}
然而,從上面的代碼,我得到像下面這樣的輸出:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 //Wrong!
爲什麼我會得到這個輸出?我想要得到每一個問題。我應該如何得到它?
只是1秒太快對我來說: ) – Rizier123
這就是她所說的! :D –
@JohnConde尼斯,我從你身上學到了一些東西...... – KKL