I have a loop within PHP that is supposed to get the last 12 full months that have passed. Today, May 31st, the labels for those months seem to be duplicating.
March replaces February December replaces November October replaces September
$count = 1;
$date_array = array();
while ($count <= 12) {
// Calculate date
$query_year = date('Y', strtotime('-' . $count . ' months America/Chicago'));
$query_month = date('m', strtotime('-' . $count . ' months America/Chicago'));
$display_month = date('M', strtotime('-' . $count . ' months America/Chicago'));
$date_array[] = array(
'query_year' => $query_year,
'query_month' => $query_month,
'display_month' => $display_month
);
$count ++;
}
print_r($date_array);
Here's the code in action: http://ideone.com/dBklOH
Any idea why this is happening? It only started today, the 31st of May, and will likely resolve itself by tomorrow.