**Files by date descending order, How to do it? ** Need to show Files by date latest at top
function list_dir($dn){
if($dn[strlen($dn)-1] != '\\') $dn.='\\';
static $ra = array();
$handle = opendir($dn);
while($fn = readdir($handle)){
if($fn == '.' || $fn == '..') continue;
if(is_dir($dn.$fn)) list_dir($dn.$fn.'\\');
else $ra[] = $dn.$fn;
}
closedir($handle);
return $ra;
}
$filelist = list_dir('D:\xampp\htdocs');
for($i=0;$i<count($filelist);$i++){
$test = Array();
$year = $test[2];
$day = $test[1];
$month = $test[0];
$test = explode("/",date("m/d/Y",filemtime($filelist[$i])));
echo "<span style='color:red;'><b style='color:green;'>".$day.'-'.month.'-'.$year. '</b> ' . $filelist[$i]."</span><br>";
}
clearstatcache();