What is the potential pitfall of using strpos in PHP?

The potential pitfall of using strpos in PHP is that it returns false if the substring is not found in the string, which can lead to unexpected behavior if not handled properly. To solve this issue, you should use the strict comparison operator (===) to check for the exact position of the substring.

$haystack = "Hello, World!";
$needle = "World";

$pos = strpos($haystack, $needle);

if ($pos !== false) {
    echo "Substring found at position: " . $pos;
} else {
    echo "Substring not found";
}