Jump to content

[SOLVED] break and cotinue a loop


corillo181

Recommended Posts

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.