Does anybody have an idea how can I sort this array by key (date) in PHP?
Array ( [2011-02-16] => Array ( [date] => 2011-02-16
Use the uasort function, which is user customizable sorting. Like this:
function cmp($a, $b) { if ($a['date'] == $b['date']) { return 0; } return ($a['date'] < $b['date']) ? -1 : 1; } uasort($your_array, "cmp");