将for循环转换为foreach循环

时间:2017-10-01 17:25:50

标签: php for-loop foreach

我在这里有一些工作代码,我想知道是否有办法将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;


}

0 个答案:

没有答案