combining dynamic text with regular expressions in php
- by pfunc
I am experimenting with finding popular keywords using curl, php and regular expressions. I have an array of non-specific nouns that I am matching my keyword search up. So I am looking for words like "the", "and", "that" etc. and taking them out of the keyword search.
so I have an array of words like so:
$wordArr = [the, and, at,....];
and then running something like:
&& preg_match('(\bmyword\w*\b)', $key) == false
how do I combine these two so it loops through the array finding out if any of the words in the array match the regular expression?
I guess I could just do a for loop, but though maybe I could use in_array($wordArr, $key).. or something like that.