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). 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) { } 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? 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. Link to comment https://forums.phpfreaks.com/topic/211892-for-loop-to-199/#findComment-1104431 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.