corillo181 Posted July 3, 2007 Share Posted July 3, 2007 alright so the idea is to take the current month and add 9 more months to it.. but when it gets to 12 since 13 is not a month i need the loop to break out and continue the rest of the number as 1 2 3 4 and so on.. this is wha ti have so far. <?php for($i=date("m");$i<date("m")+9;$i++){ $year=($i>12)?date("Y")+1:date("Y"); calendar($i,$year,NULL); } ?> Link to comment https://forums.phpfreaks.com/topic/58295-solved-break-and-cotinue-a-loop/ Share on other sites More sharing options...
wcsoft Posted July 3, 2007 Share Posted July 3, 2007 Something like this would work: $month = $date("m"); $year = $date("Y"); for($i=1;$i<=9;$i++) { calendar($month,$year,NULL); $month++; if ($month > 12) { $month = 1; $year++; } // end if } // end for Link to comment https://forums.phpfreaks.com/topic/58295-solved-break-and-cotinue-a-loop/#findComment-289026 Share on other sites More sharing options...
corillo181 Posted July 3, 2007 Author Share Posted July 3, 2007 nice!! Link to comment https://forums.phpfreaks.com/topic/58295-solved-break-and-cotinue-a-loop/#findComment-289046 Share on other sites More sharing options...
wcsoft Posted July 3, 2007 Share Posted July 3, 2007 As typical, I really need to pay attention to the code I post. The $date portions, should just be date: $month = date("m"); $year = date("Y"); for($i=1;$i<=9;$i++) { calendar($month,$year,NULL); $month++; if ($month > 12) { $month = 1; $year++; } // end if } // end for Link to comment https://forums.phpfreaks.com/topic/58295-solved-break-and-cotinue-a-loop/#findComment-289061 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.