我在这里有一些工作代码,我想知道是否有办法将for循环修改为foreach循环。
if (isset($_POST['submit'])==true){
$count = intval($_POST['clickCount']);
$count += 1;
//change this for loop into a foreach
for ($copying =0; $copying <1; $copying++){
echo $_SESSION['question'][$count-1];
}
}else{
echo "Welcome to trivia! Enter your answer below for the following question:
<br><br>";
echo $_SESSION['question'][0];
$count = 1;
}