這是我的代碼:$bag3 = 7;$row = 4;$nom = 1;$arr = array("red", "green", "blue", "yellow");while ($bag3){while ($nom <= $bag3){ echo $ay." ".$row; $nom++; $row++;}if ($nom == $bag3){ $nom = 1;}}這是輸出:red 4red 5red 6red 7red 8red 9red 10 我希望它遍歷所有數(shù)組值:red、green、blue和yellow. 像這樣:red 4red 5red 6red 7red 8red 9red 10green 11green 12green 13green 14green 15green 16green 17blue 18blue 19blue 20blue 21blue 22blue 23blue 24yellow 25yellow 26yellow 27yellow 28yellow 29yellow 30yellow 31我應(yīng)該在我的代碼中更改什么?
php foreach 只是在數(shù)組的一個值上循環(huán)
慕無忌1623718
2022-05-27 16:28:37