In plain English: strpos() returns 0 when the match is at the very start
of the string. PHP treats 0 as false, so if (strpos(...)) treats a match at
position zero as “not found.”
Why it matters: A valid match can silently take the “not found” branch.
if (strpos($path, '/')) {
// A leading slash is at position 0, so this branch is skipped.
}
if (strpos($path, '/') !== false) {
// Found, including a match at position 0.
}
if (str_starts_with($path, '/')) {
// Clearer when you only care about the prefix.
}
if, elseif, while, do/while, and for conditions!strpos($haystack, $needle)&&, ||, and, or, or xorA comparison makes the false result explicit. !== false, === 0, and
>= 0 are accepted.
false, 0, or another value.!== false when you only need “found or not found.”=== 0 when you specifically mean “starts at position 0.”str_contains() or str_starts_with() on PHP 8+.E0050 has no configuration options and is enabled by default.