Re: duplicate filenames but different .extention
| From: | Curt Zirzow | Date: | Mon, 19 Dec 2005 00:03:53 +0000 |
| Subject: | Re: duplicate filenames but different .extention | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-227633@lists.php.net to get a copy of this message | ||
On Sun, Dec 18, 2005 at 05:12:33PM -0600, matt VanDeWalle wrote:
> hello again
> I am trying to figure out how i can read the list of files in a directory
> using the opendir() and readdir() functions. Normally this goes fine but
> within the loop, what i am wanting to do is echo the filename if it is a
> jpg file, but if its a .gif, just continue.
One option, is to use glob():
foreach(glob('/path/tofiles/*.jpg') as $image ) {
echo $image;
}
Curt.
--
cat .signature: No such file or directory