jeudi 30 avril 2015

Get last X files created from a directory (PHP)

Im using this code to get the most recent file created:


    $files = glob($siteRoot.'/dir/*/*.php');
    $files = array_combine($files, array_map('filectime', $files));
    echo key($files); 


How can I enhance this to get the last 3 files created, or what ever number I need? Any help would be appreciated. Thanks!

Aucun commentaire:

Enregistrer un commentaire