Tutorial Find Highest Numerically Named File

$latest = getNewest("/path/to/folder/*_bla.xml"); function getNewest($xmlfile){ foreach (glob($xmlfile) as $filename) { ...

$latest = getNewest("/path/to/folder/*_bla.xml");

function getNewest($xmlfile){
foreach (glob($xmlfile) as $filename) {
$c = explode('_', basename($filename));
$files[$c[0]] = $filename;
}
ksort($files, SORT_NUMERIC);
$latest = array_pop($files);
if (file_exists($latest)){
return $latest;
}
return false;
}
In a folder are files named:

Hot in Week

Popular

Archive

item