* Thus wrote Matt Palermo ([EMAIL PROTECTED]): > I have a bunch of dates in the form: MM-DD-YYYY in an array and I want to > sort them and display them in descending order. I have tried the usort() > function below and it's not working. Can anyone help me out here? > > $menu_item = array(); > $menu_item[] = "12-04-2003"; > $menu_item[] = "11-19-2003"; > $menu_item[] = "01-04-2004"; > $menu_item[] = "12-24-2003"; > $menu_item[] = "08-13-1982"; > > // sorting function > function date_file_sort($a, $b) > { > $a = strtotime($a); > $b = strtotime($b);
12-04-2003 is not a valid date formate for strtotime(). http://www.gnu.org/manual/tar-1.12/html_chapter/tar_7.html Curt -- If eval() is the answer, you're almost certainly asking the wrong question. -- Rasmus Lerdorf, BDFL of PHP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php