Answers for "check if string contains specific string php"

PHP
65

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
5

how to check if a string contains a substring in php

$a = 'How are you?';

if (strpos($a, 'are') !== false) {
    echo 'true';
}
Posted by: Guest on October-18-2020

Code answers related to "check if string contains specific string php"

Browse Popular Code Answers by Language