Reputation: 1104
How can I see if a given string contatin multiple characters that I want to look for? for ex:
$manywords = "apple orange pineapple banana cat";
if (!(strstr($manywords, 'apple'||'cat')))
{
echo "either word found";
}
is there a way I can use strstr
function without having to write it twice as follows:
if (!((strstr($manywords, 'apple')||(strstr($manywords, 'cat')))
{
echo "either word found";
}
Upvotes: 0
Views: 66