View Full Version : PHP wildcard character??


shining on
04-02-2006, 06:10 PM
hi all,

does anyone know if there's a wildcard character to add to if/else conditions? For example, if u wanted to search your computer for all html files you'd search for "*.html" or "*folder_name/*" to find all files in a folder - can this be done in php?

what i'm trying to do is say if the file name (PHP_SELF) is within a certain folder do this, if not, do that...

Wermaus
04-03-2006, 09:27 AM
Hi!

For such things, you can use Regular Expressions.
They are a bit tricky, but get the job done very well.
You can use PCRE and POSIX.
Here are some links that might help you:
regex (http://weblogtoolscollection.com/regex/regex.php)
phpbuilder.com (http://www.phpbuilder.com/columns/dario19990616.php3)

harmor
04-04-2006, 04:08 AM
You could try preg_match
http://us2.php.net/preg_match