Can anyone suggest how I would do this: Say if I had the string $text which holds text entered by a user. I want to use an ‘if statement’ to find if the string contains one of the words $word1 $word2 or $word3 . Then if it doesn’t, allow me to run some code.
if ( strpos($string, '@word1' OR '@word2' OR '@word3') == false ) {
// Do things here.
}
I need something like that.
More flexibile way is to use array of words:
Result is: word1 exists in text