Advertisement
nocturnalmk

list the months from x to x next year

Jul 25th, 2014
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.42 KB | None | 0 0
  1. <?php
  2.  
  3. date_default_timezone_set('Europe/Skopje');
  4.  
  5. $month = 5;
  6. $year = 2013;
  7.  
  8.  
  9. $count = 0;
  10. for ($m = $month;$m <= 12; $m++){
  11.  
  12.         $count++;
  13.         $month =  date("M", mktime(0, 0, 0, $m));
  14.  
  15.         echo $month ." ". $year ."\n";
  16.  
  17.         if ($m == 12 && $count < 12) {
  18.                 $m = 0;
  19.                 $year++;
  20.         }
  21.  
  22.         if ($count == 12) {
  23.                 break;
  24.         }
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement