Created
July 20, 2016 08:59
-
-
Save otkrsk/59d7b24f04d977883f4bb70b540ce3ce to your computer and use it in GitHub Desktop.
Scan a directory and sort the files according to the last modified date.
This file contains hidden or 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
| <?php | |
| function scan_dir($dir) { | |
| $ignored = array('.', '..', '.svn', '.htaccess'); | |
| $files = array(); | |
| foreach (scandir($dir) as $file) { | |
| if (in_array($file, $ignored)) continue; | |
| $files[$file] = filemtime($dir . '/' . $file); | |
| } | |
| arsort($files); | |
| $files = array_keys($files); | |
| return ($files) ? $files : false; | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment