Hey hey!

I'm having a bit of an issue sorting by date with arrays. For example...

I did some scouring around and found these dateAsc and dateDesc functions. It doesn't work at all.

PHP Code:
function dateAsc($a$b) {
    return 
strcmp($a["date"], $b["date"]);
}

function 
dateDesc($a$b) {
    return 
strcmp($b["date"],$a["date"]);
}

while (
false !== ($file readdir($dir_handle))) {  //loop through all the files in the path
        
if ($file == "." || $file == "..") {
            continue;
        }  
//ignore these
        
        // these have to be htm files
        
if (substr_count($file".htm") > 0) {
            
// now we gotta make the files ledgible. 
            
$arr_split_it explode("__",$file);
            
$press_date[$count] = strtotime($arr_split_it[0]);
            
$press_title[$count] = $arr_split_it[1];
            
            
$press_list[$count] = "<li><a href=\"press.php?file=" urlencode($file) . "\">" str_replace("__"," ",str_replace(".htm","",stripslashes(urldecode($file)))) . "</a></li>";
            
$count++;
        }
    }

uasort($press_date"dateDesc"); 
The output looks like this:


  • 07-01-08 New Power Engineer
  • 04-08-08 Data Network
  • 04-08-09 Fiber to the Home
As you can see, the dates are not in order.

Basically this scripts reads files from a directory with the date in the file name, removes the double underscore and the .htm extension and displays it as a readable format on a web page.

All I need to be able to do now is sort them by the date descending. And no, databases are not an option here.

Any thoughts? Thanks!