次のファイル構造を検討してください。
/folder/locaux-S04_3.html
/folder/blurb.txt
/folder/locaux-S04_2.html
/folder/locaux-S05_1.html
/folder/tarata.02.jpg
/folder/locaux-S04_1.html
/folder/dfdsf.pdf
ディレクトリ内の最大の数値を含む名前のファイルを取得する必要があります。上記の例では、locaux-S05_1.html です。
locaux-S*.html ファイルのみを取得する効率的な方法として glob() を思いつきましたが、次のステップで行き詰まっています。ファイル名に最高の値が含まれているファイルを見つけることです。
$files= glob(LOCAUX_FILE_PATH.'/locaux-S*.html');
foreach($files as $key=> $value){
// loop through and get the value in the filename. Highest wins a trip to download land!
$end = strrpos($value,'.');
$len= strlen($value);
$length = $len-$end;
$str = substr($value,8,$length);
// this gives me the meat, ex: 03_02. What next?
}
どんなポインタでも大歓迎です。