Search code examples
phpstrpos

How can I check a few parametres in this strpos line?


if (strpos($text,'City') !== false) ...

In that "IF" line, I wanna check a few parametres. For example "City, Weather, etc" How can i do that?

Edit: Thank you for all answers


Solution

  • You can do it another way by using in_array() function.

    $array = array('City','Weather','anything');
    if (in_array($text, $array)) {
        echo "Yes";
    }