Consider this scenario:
if (strpos($string, $substring)) { }
If $substring is at the exact start of $string , the return value is 0. Unfortunately, inside the if, this evaluates to false , so the condition is not met.
The correct processing method:
if (false !== strpos($string, $substring)) { }
Output:
false will always be false. Other values ββmay not guarantee this. For example, in PHP 3 empty('0') was true , but later it was changed to false .
Sarfraz
source share