Answers for "check if contain word php"

PHP
93

php check if string contains word

$myString = 'Hello Bob how are you?';
if (strpos($myString, 'Bob') !== false) {
    echo "My string contains Bob";
}
Posted by: Guest on August-06-2019
1

php if string contains

if (str_contains('How are you', 'are')) { 
    echo 'true';
}
Posted by: Guest on March-07-2022

Code answers related to "check if contain word php"

Browse Popular Code Answers by Language