# Watch out for aberrant partial matches
$string = 'The lazy fox jumped over the fence';
if (str_contains($string, 'ox')) {
echo 'The string "ox" was found in the string because it was a partial match';
} else {
echo '"ox" was not found';
}
//output: The string "ox" was found in the string because it was a partial match
# use spaces for full word matching
$string = 'The lazy fox jumped over the fence';
if (str_contains($string, ' ox ')) {
echo 'The string " ox " was found in the string because it was a partial match';
} else {
echo '" ox " was not found';
}
//output: " ox " was not found