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
What you want is UASORT.
http://us3.php.net/manual/en/function.uasort.php
function would be like:
function cmp($a, $b) { $d1 = strtotime($a['date']); $d2 = strtotime($b['date']); if ($d1 == $d2) { return 0; } return ($d1 < $d2) ? -1 : 1; }