我的$数组有32个值,我想使用循环,但我不知道。如何在php中使用循环
if ($array[0] > 1)
{
echo $array[0];
unset($array[0]);
}
else if ($array[1] > 1)
{
echo $array[1];
unset($array[1]);
}
else if ($array[2] > 1)
{
echo $array[2];
unset($array[2]);
}
else
{
echo "<a href=' ".$_SERVER['PHP_SELF']."?month=".$monthstring."&day=".$daystring."&year=".$year." '>".$i." </a></td>";
}
你究竟想要做什么? – T0xicCode
您可以使用[foreach](http://php.net/manual/en/control-structures.foreach.php),[for](http://php.net/manual/en/control-structures.for .php)或[while](http://php.net/manual/en/control-structures.while.php)遍历数组。 – JimL
我可以看到有一个$ i变量,从它看起来你已经尝试循环? – chba