I want to check if the string is present in another string
even if the string is in this format: are, ARE, Are, aRe, arE
$str = "how aRe you doing";
if (strpos($str,'are') !== false)
{
echo 'true';
}
I want to check if the string is present in another string
even if the string is in this format: are, ARE, Are, aRe, arE
$str = "how aRe you doing";
if (strpos($str,'are') !== false)
{
echo 'true';
}
Use stripos()
instead of strpos()
.
int stripos ( string $main_string , string $substring [, int $offset = 0 ] )
You can use strpos function with strtolower function
$str = "how are you doing";
$ndl = 'ArE';
if (strpos(strtolower($str),strtolower($ndl))) {
echo "true";
}else{
echo "false";
}
$str = "how aRe you doing";
if (strpos(strtolower($str),'are') !== false)
{
echo 'true';
}