开发者

Find substring or exact string in php

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜