glob - multiple patterns

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Nicolaas
Forum Newbie
Posts: 3
Joined: Sun Aug 03, 2003 12:24 pm

glob - multiple patterns

Post 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
m3rajk
DevNet Resident
Posts: 1191
Joined: Mon Jun 02, 2003 3:37 pm

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