0

With these variables..

$month1  = 8;  // A month in the past
$month2  = date('n');  // Current month

...I need to a loop that outputs this:

August, September, October, November, December, January, February, March

8 is obviously the 8th month, hence August.

I realise the vars are using numeric representation, but the output needs to be a comma separated list of full textual representations of the month names.

Any help would be awesome.

User_FTW
  • 504
  • 1
  • 16
  • 44

1 Answers1

0
$month1  = 8;  // A month in the past
$month2  = date('n') + 12; 

for ($i = $month2; $i >= $month1; $i--)
    $m[] = date('F', mktime(0, 0, 0, ($i % 12), 10));

$months = implode (",", $m);
print $months;
diavolic
  • 722
  • 1
  • 4
  • 5