我的$數組有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