1 2 3 4 5 6 7 8 9 10 11
<?php $months = array(); $currentMonth = (int)date('m'); for($x = $currentMonth; $x >=$currentMonth-12; $x--) { $months[date('F', mktime(0, 0, 0, $x, 1))] = 0; } echo "<pre>"; print_r ($months); ?>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
<pre>Array ( [September] => 0 [August] => 0 [July] => 0 [June] => 0 [May] => 0 [April] => 0 [March] => 0 [February] => 0 [January] => 0 [December] => 0 [November] => 0 [October] => 0 )