When I use strpos it returns false if the both string开发者_JAVA百科s are equal. Is there a function or a parameter to this function that returns tru if there is a substring in the main string or both strings are equal?
Or am i wrong and it does it for the full string also?
You are wrong - strpos()
does not return false
, it returns 0
. Just do strpos() !== false
to find out if it matched.
It isn't returning false, you're just not checking strict equality. Use ===
instead of ==
, cause it found it at index 0.
精彩评论