Are there any potential pitfalls in using strtolower() and strpos() functions to search for a word in a PHP variable?

Using strtolower() and strpos() functions to search for a word in a PHP variable may lead to inaccuracies if the word is not consistently formatted (e.g., different cases or special characters). To avoid this issue, it is recommended to normalize the case of both the word being searched for and the variable before using strpos().

$word = "example";
$variable = "This is an Example sentence.";
$normalized_word = strtolower($word);
$normalized_variable = strtolower($variable);

if(strpos($normalized_variable, $normalized_word) !== false) {
    echo "Word found in variable.";
} else {
    echo "Word not found in variable.";
}