PHP program to check a substring exists within the given string using a regular expression pattern
<?php
//PHP program to check a substring is exists
//within the given string using regular expression pattern.
$str = "www.includehelp.com";
$pattern = "/includehelp/";
$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
