$months = array();
$first = strtotime("first day this month");
for ( $i = 1; $i <= 6; $i++ ) {
array_push($months, date('F', strtotime("-$i month", $first)));
}
var_dump($months);
This code is not working properly when run today (in march)
Output:
array(6) {
[0]=>
string(5) "March"
[1]=>
string(7) "January"
[2]=>
string(8) "December"
[3]=>
string(8) "November"
[4]=>
string(7) "October"
[5]=>
string(9) "September"
}
Where is February?