Over a million developers have joined DZone.

Loop In PHP Using For (Descending)

·
For 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";
}
Topics:

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}