How to find 2 or more words in a string with preg_match?
hay there
How can i check for say 2 or more words in a string…
Imagine a search engine type scenario where the user enters a number of keywords to search
Now I know this checks for 2 words on a "OR" basis
PHP:
if(preg_match("/$findthis|$this/i", $text_to_search))
{
//do something
}
So this ill check to see if the
PHP:
$text_to_search
contains either
PHP:
$findthis
or…
How to find 2 or more words in a string with preg_match?
See original post by johnd123
Leave a Reply
You must be logged in to post a comment.