The current issue I’m facing is this.
I have a directory as such webroot:banners/users/
The directory contains user images named as such:
136-20111115001231.jpg
(where "136" equals a users ID and the remaining numbers are a timestamp)
So for instance if we had these stored in our directory:
136-20111115001231.jpg
255-20100228153178.jpg
10-20111003124511.jpg
320-20090130145800.jpg
Is there a way of easily searching for a file in our directory (using PHP) that begins with a specified user id?
For instance, if we wanted to find the user image for $userid (136 for instance) could we do something the equivalent of:
<?php
$filename = filefind("banners/users/$userid*.jpg");
?>
Which would search for jpegs starting with “136” and return the filename (in this case – 136-20111115001231.jpg).
I had a look at some PHP filesystem references but I’m sure I keep overlooking the function that would do this.
Any help you could give would be brilliant!
My guess is that this is an easy one 🙂
Cheers, Al
You’re looking for
glob().