why is a strpos that is !== false not true?
问题 Consider the following example: $a='This is a test'; If I now do: if(strpos($a,'is a') !== false) { echo 'True'; } It get: True However, if I use if(strpos($a,'is a') === true) { echo 'True'; } I get nothing. Why is !==false not ===true in this context I checked the PHP docs on strpos() but did not find any explanation on this. 回答1: Because strpos() never returns true: Returns the position of where the needle exists relative to the beginning of the haystack string (independent of offset).