0

When I use strpos it returns false if the both strings 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?

2 Answers 2

3

You are wrong - strpos() does not return false, it returns 0. Just do strpos() !== false to find out if it matched.

Sign up to request clarification or add additional context in comments.

Comments

1

It isn't returning false, you're just not checking strict equality. Use === instead of ==, cause it found it at index 0.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.