Jump to content


Photo

Glob function, anyone know it?


  • Please log in to reply
2 replies to this topic

#1 Mutley

Mutley
  • Members
  • PipPipPip
  • Advanced Member
  • 765 posts

Posted 19 September 2006 - 10:04 AM

Simple put:

$thumbnail_files = glob($thumbnail_folder . "/*jpg");

I would like it to find "jpg" AND "JPG" not just jpg which it is atm.

Can't seem to get it to work however. If anyone knows how?
~ Mutley.

#2 onlyican

onlyican
  • Members
  • PipPipPip
  • Advanced Member
  • 921 posts
  • LocationHants - UK

Posted 19 September 2006 - 10:30 AM

I dont know glob very well, I have checked the manual, and I cant see any flags which is about case sensative
try ADDING
$thumbnail_files .= glob($thumbnail_folder . "/*JPG");
Tell me the problem, I will try tell you the solution

#3 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 19 September 2006 - 10:39 AM

Use glob_brace - direct from the manual - http://ca.php.net/ma...nction.glob.php

Here's an example of how to use the GLOB_BRACE flag:

$images = glob("/path/to/images/{*.jpg,*.JPG}", GLOB_BRACE);

It's also worth noting that when using the GLOB_BRACE flag in any version of PHP prior to 4.3.4, PHP will crash if no matches are found.


Legend has it that reading the manual never killed anyone.
My site




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users