I'm not familiar with PHP associate arrays so I'm hoping someone can shed some light on the subject and suggest how to solve my particular problem.
I have an array of data, of which each element is a string of "Month, Year
".
I want to parse through that data and create an associate array where the keys are the years and the values are an array of months of that year.
For example, I have the array("November, 2011", "May, 2011", "July, 2010")
Using a foreach loop, I want to parse through this data and create the array:
array( "2011" => array("Novemeber", "May"), "2010" => array("July"))
From what I can see, I need to know how to check if a key is there, if it isn't create it and make a new array as its value, if it is, append the month to the already there value array.
If that makes sense, any help would be appreciated! thanks!