Je souhaiterai conjuguer deux fonctions afin de trouver le fichier le plus récent commençant par:
et
Mais comment ?
Merci par avance
$path = "/home/www/images/xml_cache";
$nom="images_album_6*.xml";
foreach (glob($path.'/'.$nom.'') as $filename) { }
et
$latest_ctime = 0;
$latest_filename = '';
$d = dir($path);
while (false !== ($entry = $d->read( ))) {
$filepath = "{$path}/{$entry}";
// could do also other checks than just checking whether the entry is a file
if (is_file($filepath) && filectime($filepath) > $latest_ctime) {
$latest_ctime = filectime($filepath);
$latest_filename = $entry;
}
}
}
Mais comment ?
Merci par avance