php - Loop through array and display year once, months after
619
I'm retrieving dates from an SQL query with PHP, and I can't seem to get my head around how to display each year and its months based on this rather simple array:
Array ( [0] => stdClass Object ( [monthname(wp_posts.post_date)] => July [year(wp_posts.post_date)] => 2012 ) [1] => stdClass Object ( [monthname(wp_posts.post_date)] => June [year(wp_posts.post_date)] => 2012 ) [2] => stdClass Object ( [monthname(wp_posts.post_date)] => May [year(wp_posts.post_date)] => 2011 ) )
What I want to be displayed is this:
2012 - July - June 2011 - May
Answer
Solution:
Now you have a array like this:
QUICK AND DIRTY SOLUTION