smartalco Posted January 22, 2008 Share Posted January 22, 2008 basically what the title says, is it possible to use regular expressions within an if() conditional statement? ie, something likeif ($var == '*image*') {}the reason why is I made a search function for the website im making and im trying to exclude it from searching certain folders, this particular instance being all folders that have images in them (and hence would have 'image' in the name of the folder itself)is this possible or am I just dreaming up awesome features? Link to comment Share on other sites More sharing options...
justsomeguy Posted January 23, 2008 Share Posted January 23, 2008 One of the PHP extentions for regexp is the Perl-compatible regular expressions, or PCRE:http://www.php.net/manual/en/ref.pcre.phpThere are some PCRE functions that return true/false that you can use in an IF or other logic statement. Link to comment Share on other sites More sharing options...
Synook Posted January 23, 2008 Share Posted January 23, 2008 if (preg_match("/(.*?)image(.*?)/", $var)) { } Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.