Reading some file names on the server and creating a variable
Posted on 2007-09-27
I have some files in the "./files/" directory.
Some of these files are named "random_001.jpg", "random_002.jpg", "random_003.jpg" etc...
I need PHP to look in this directory and find all of the "random_XXX.jpg" files and find the last one (the highest numbered file).
I need that number as a variable.
On top of that...
If the number is "005", for instance, I only want the variable to be "5"
If the number is "020", I want the variable to be "20" and so on.
Can someone throw that little script together?