PHP Scan a dir and order by date – new first

This is how I’v made it

 $photos = array_reverse(glob($_SERVER['DOCUMENT_ROOT'].'/photos/thumbs/*.{jpg,JPG,jpeg,gif,png}', GLOB_BRACE));
 usort($photos, create_function('$b, $a', 'return filemtime($a) - filemtime($b);'));

 

Leave a Reply

Your email address will not be published. Required fields are marked *


*