检查word是否是子字符串 - php

I would like to check if a given string is a substring to another string. For example:

$a = 'Hello World!';
$b = 'ell';

$b is a substring of $a. Any functions that can check this?

Try this

$a = 'Hello World!';
$b = 'ell';
if (strpos($a, $b) !== false) {
    echo true; // In string
}

You can use strpos() function to check that

    <?php
        if (strpos('Hello World!','ell') !== false) {
        echo 'contains';
    }
   else echo 'not contains';

http://php.net/manual/en/function.strpos.php

$mystring = 'abc';
$findme   = 'a';
$pos = strpos($mystring, $findme);

if ($pos === false) {
echo "The string '$findme' was not found in the string '$mystring'";
} else {
echo "The string '$findme' was found in the string '$mystring'";
echo " and exists at position $pos";
}