Re: duplicate filenames but different .extention

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

 



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.
I have several files i wish to seperate based on the basename of the file.
i read the basename help file and know how to use it even to exclude the .3letterextention. I am however wanting to skip if it happens to be a .gif, is there some sort of way to i guess, do the basename function in reverse, e.g if it comes across "xxxxxx.gif" it would skip it but not skip over the xxx.jpg files? that is my latest problem, it skips everything when i have a line like this in my loop

if($file = basename('.gif',$file))
continue;
else go on with code


if ( ereg("\.gif$", $file) ) {
	continue;
}

would do it.. so would

if ( substr($file, -4) == ".gif" ) {
	continue;
}

Don't forget about ".GIF" though if that might be an issue for you...

--
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