PHP program to check a case insensitive substring exists within the given string using regular expression pattern

bookmark

<?php
//PHP program to check a case in-sensitive 
//substring is exists within the given string 
//using regular expression pattern.
$str = "www.includehelp.com";
$pattern = "/IncludeHelp/i";

$res = preg_match($pattern, $str);

if ($res == 1)
{
    printf("Substring found successfully");
}
else
{
    printf("Substring did not find in the string");
}

?>


Output
Substring found successfully