How can I use PHP to include the most recent file in a directory?
Question
I have a directory which will look something like this:
/test/
|
|- index.php
|- test-20110324
|- test-20090901
|- test-20070901
What I want to do is use "index.php" to find the most up-to-date file, and require
it into the "index.php" file.
Please note: The included file needs to be selected by the date-stamp suffix, as opposed to the file modification time, as these older files my need to be edited-in-place, without taking precedence over the most up-to-date file.
This concept will be applied over several directories, but the HTML files will all following the pattern above, i.e. WORD-YYYYMMDD.
Any ideas on how to do this? I will be very grateful if anybody could spare a moment to help me out here!!!
Thanks in advance!
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow