[thelist] PHP - wildcard with stristr()

Bill Haenel bill at webmarketingworx.com
Sat Mar 23 12:18:01 CST 2002


>     | Anyone know if there's any way to use any sort of
>     | wildcard with PHP's stristr()?
>
>
> It is perhaps easier to give you ideas if you state your problem? Most
> likely, a wild card may not be the best solution to your problem to
> begin with but reg exp functions like "eregi".

I'm running a very simple list of files in any given directory based on
certain criteria. i.e., list if file name contains "whatever". I was hoping
to enable something like 'name%' or 'name_number', where '%' and '_' are the
wildcards, as you would do with SQL.

a specific example:

if ($file != "." and $file != ".." and stristr("$searchstring", $file)) {
	echo $file;
}

$searchstring could then be "name_numebr" or "name%" or something.

Thanks,

Bill




More information about the thelist mailing list