Loop In PHP Using For (Descending)
Join the DZone community and get the full member experience.
Join For FreeFor those times you need to do a loop in PHP, but have the outcome be in descending order (ie, start at 10 and end at 1).
$totalcode="10";
for($i=$totalcode; $i>0; $i--){
echo"$i";
}
PHP
Opinions expressed by DZone contributors are their own.
Comments