Sort file list by date


/ Published in: PHP
Save to your folder(s)

Sort file list by date


Copy this code and paste it in your HTML
  1. $files=scandir('.');
  2.  
  3. $get_time = create_function('$file','return filemtime($file);');
  4. $times= array_map($get_time, $files);
  5.  
  6. array_multisort($times, SORT_ASC, SORT_NUMERIC, $files, SORT_ASC, SORT_STRING);

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.