List directory contents by date (PHP)


SUBMITTED BY: scripts4you

DATE: Oct. 21, 2015, 9:01 a.m.

FORMAT: Text only

SIZE: 445 Bytes

HITS: 1895

  1. function listdir_by_date($path){
  2. $dir = opendir($path);
  3. $list = array();
  4. while($file = readdir($dir)){
  5. if ($file != '.' and $file != '..'){
  6. // add the filename, to be sure not to
  7. // overwrite a array key
  8. $ctime = filectime($data_path . $file) . ',' . $file;
  9. $list[$ctime] = $file;
  10. }
  11. }
  12. closedir($dir);
  13. krsort($list);
  14. return $list;
  15. }

comments powered by Disqus