[UPHPU] simple??? php function (display an index)

Mac Newbold mac at macnewbold.com
Fri Jul 21 23:01:55 MDT 2006


Today at 10:51pm, Caleb Call said:

> Thanks for the info (I finally got around to being able to look-up some of 
> this stuff) and I really like the glob() function, I think I'll use 
> that...couldn't that be used (partially) to do the thumbnail thing you 
> suggested as well?

Absolutely. Any time you need a list of files that can be specified by a 
wildcard expression, glob() is by far my favorite. Another neat trick with 
glob() is to check out the options regarding braces. They'll enable you to 
put in globs that are even more specific:

Find the right apache logs:
glob("/var/log/httpd-{access,error}.log") =
/var/log/httpd-access.log (if it exists)
/var/log/httpd-error.log (if it exists)

Find some images of certain extensions:
glob("*.{png,jpg,gif}")

Or find all your executable files in the normal directories:
glob("{,/usr{,/local}}/{,s}bin/*")
/bin/*
/usr/bin/*
/usr/local/bin/*
/sbin/*
/usr/sbin/*
/usr/local/sbin/*

There's so much that glob can do that opendir/readdir/closedir just can't 
even touch. And if glob doesn't do what you need, use backticks to run a 
"find" command in the shell with all the right parameters, and you can't 
go wrong.

Mac

--
Mac Newbold		MNE - Mac Newbold Enterprises, LLC
mac at macnewbold.com	http://www.macnewbold.com/


More information about the UPHPU mailing list