newbtophp Posted August 27, 2010 Share Posted August 27, 2010 I'm trying to do a for loop to provide 2 numbers $x and $i, +199 every time?. E.g. First loop: $i = 200; $x = 399; Second loop: $i = 400; $x = 599; Third loop: $i = 600; $x = 799; and so on until $x = 1400; (then stop). Quote Link to comment https://forums.phpfreaks.com/topic/211892-for-loop-to-199/ Share on other sites More sharing options...
Alex Posted August 27, 2010 Share Posted August 27, 2010 That's not adding 199 every loop, that's adding 200. for($i = 200, $x = 399;$x >= 1400;$i += 200, $x += 200) { } Quote Link to comment https://forums.phpfreaks.com/topic/211892-for-loop-to-199/#findComment-1104412 Share on other sites More sharing options...
newbtophp Posted August 27, 2010 Author Share Posted August 27, 2010 Cheers that worked alhough i think theirs a slight error did you mean <= instead of >= within the for loop? Quote Link to comment https://forums.phpfreaks.com/topic/211892-for-loop-to-199/#findComment-1104423 Share on other sites More sharing options...
Alex Posted August 27, 2010 Share Posted August 27, 2010 Yeah, that's what I meant, sorry. Quote Link to comment https://forums.phpfreaks.com/topic/211892-for-loop-to-199/#findComment-1104431 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.