This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function scan_dir($dir) { | |
$ignored = array('.', '..', '.svn', '.htaccess'); // -- ignore these file names | |
$files = array(); //----------------------------------- create an empty files array to play with | |
foreach (scandir($dir) as $file) { | |
if ($file[0] === '.') continue; //----------------- ignores all files starting with '.' | |
if (in_array($file, $ignored)) continue; //-------- ignores all files given in $ignored | |
$files[$file] = filemtime($dir . '/' . $file); //-- add to files list | |
} | |
arsort($files); //------------------------------------- sort file values (creation timestamps) | |
$files = array_keys($files); //------------------------ get all files after sorting |