php list directory files by date

Solutions on MaxInterview for php list directory files by date by the best coders in the world

showing results for - "php list directory files by date"
Alienor
25 May 2016
1function listdir_by_date($path){
2
3  $ar = [];
4  chdir($path);
5  array_multisort(array_map('filemtime', ($files = glob("*.*"))), SORT_DESC, $files);
6  foreach($files as $filename)
7  {
8    $ar[] = $filename;
9  }
10
11  return $ar;
12}