You can use the strstr function:
$haystack = "I know programming";
$needle   = "know";
$flag = strstr($haystack, $needle);
if ($flag){
    echo "true";
}
Without using an inbuilt function:
$haystack  = "hello world";
$needle = "llo";
$i = $j = 0;
while (isset($needle[$i])) {
    while (isset($haystack[$j]) && ($needle[$i] != $haystack[$j])) {
        $j++;
        $i = 0;
    }
    if (!isset($haystack[$j])) {
        break;
    }
    $i++;
    $j++;
}
if (!isset($needle[$i])) {
    echo "YES";
}
else{
    echo "NO ";
}