PHP scripting readdir to return file list by date instead of alphabetically.?

  • Thread starter Thread starter Mr Bigs
  • Start date Start date
M

Mr Bigs

Guest
Here it is:

function GetFileList($dirname="."){
global $config;
$list = array();

if ($handle = opendir($dirname)) {
while (false !== ($file = readdir($handle))) {
//this matches what type of files to get. jpeg, jpg, gif, png (ignoring case)
if (preg_match("/\.(jpe?g|gif|png)$/i",$file)) {
$list[] = $file;
}
}
closedir($handle);
}
sort($list);

return $list;
}#-#GetFileList()
 
Back
Top