Posted By

sorehead on 10/09/06


Tagged

php loop descending on


Versions (?)

Loop in PHP Using For (Descending)


 / Published in: PHP
 

URL: http://www.bigbold.com/snippets/posts/show/2219

  1. <?php
  2. /* Loop in PHP Using For (Descending)
  3. 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). */
  4.  
  5. $totalcode="10";
  6. for($i=$totalcode; $i>0; $i--){
  7.  
  8. echo"$i";
  9. }
  10. ?>

Report this snippet  

You need to login to post a comment.