galvin Posted April 13, 2011 Share Posted April 13, 2011 I want to have a for loop that starts at 10 and increases by 10 each time (for 9 loops), rather than increasing just by 1. How do I indicate that I want $i to go up by 10, instead of by 1. In other words, what do I write instead of "$i++"? for ($i=10; $i<=90; ?????) Quote Link to comment https://forums.phpfreaks.com/topic/233550-probably-simple-question-about-for-loops/ Share on other sites More sharing options...
QuickOldCar Posted April 13, 2011 Share Posted April 13, 2011 <?php for($i=10;$i<=100;$i +=10){ echo $i."<br>"; } ?> result: 10 20 30 40 50 60 70 80 90 100 Quote Link to comment https://forums.phpfreaks.com/topic/233550-probably-simple-question-about-for-loops/#findComment-1200907 Share on other sites More sharing options...
galvin Posted April 13, 2011 Author Share Posted April 13, 2011 Awesome thanks! Quote Link to comment https://forums.phpfreaks.com/topic/233550-probably-simple-question-about-for-loops/#findComment-1200908 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.