ok im using this code:
$dir = "/var/www/";
$count = 0;
if ($handle = opendir("$dir")) {
while (($file = readdir($handle)) !== false) {
$date = date("F d Y H:i:s.",filemtime("$dir/$file"));
$file = str_replace('www.domain.com', '', $file);
if (preg_match("/.domain.com/i",$file)) {
$file = substr($file, 4);
$count = $count + 1;
$files = array();
$files[0] = $file;
$files[1] = $date;
usort($files, function ($a, $b) {
return $a[1] > $b[1];
});
echo "$count. <a href='http://$file'>$files[0]</a> - $files[1]<br />";
}
}
closedir($handle);
echo "<br /><br />$count";
}
but it doesnt sort the results by the date, just flips the date inplace of where the domain.com links were at....