Which is all fine if you are only looking for one word (and I would have used strpos() for simplicity).
But if your strings are like this:
$str1 = "word1 word2 word3";
$str2= "word4 word1";
.. then you obviously have some more code to write. This is what I assumed the original poster meant, but then again you can usually design the problem to be simpler.