Re: duplicate filenames but different .extention

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux