preg_match() function
$pattern = '/Harris/';
$author = 'Ray Harris';
$editor = 'Joel Murach';
$author_match = preg_match($pattern, $author); // $author_match is 1
$editor_match = preg_match($pattern, $editor); // $editor_match is 1
if ($author_match === false) {
echo 'Error testing author name.';
} else if ($author_match === 0) {
echo 'Author name does not contain Harris.';
} else {
echo 'Author name contains Harris.
}
$pattern = '/murach/i';
$editor_match = preg_match($pattern, $editor);