how to check a substring in a string in php code example
Example 1: how to check if a string contains a substring in php
$a = 'How are you?';
if (strpos($a, 'are') !== false) {
echo 'true';
}
Example 2: php find if substring is in string
$result = strpos("haystack", "needle");
if ($result != false)
{
// text found
}