Page 1 of 1

glob - multiple patterns

Posted: Sun Aug 03, 2003 12:24 pm
by Nicolaas
hi

i'm having trouble with the glob function and the filenames.
i have this piece of code
foreach (glob("$_path/*.jpg") as $_file) {

it seems that *.jpg and *.JPG are not the same here.
how do i fix this so *.JPG are also seen ?
is possible to use this function for more than one extension ?
thanks

Posted: Sun Aug 03, 2003 12:37 pm
by m3rajk
add a glob for .JPEG .JPG .JPE .jpe .jpeg

ascii has a diff value for J and j.
posix systems are similar, thus case sensitivity is inherint, windows, like a mac, wants to be idiot friendly, so they get rid of it.

i believe that php was originally made for posix, thus it has quirks like treating j and J as different characters inherintly. i don't know f any way to make the glob be case insensitive, you might want to try looking it up on php.net