PHP string comparison related issues, it looks like clearly, strcmp comparison results are always not 0

Source: Internet
Author: User
Tags strcmp
PHP string comparison problem, it looks like clearly, strcmp comparison results are always not 0
An incoming ID value from the page is 1,
One is the ID value read from the file is 1
The use of strcmp comparison is always unequal, and then use strlen to test the length of the string passed in the length of 1 is actually 0, from the file read the 1 length is 1. Now consideration is caused by inconsistent coding, but how to set ah? Please advise, thank you.
------Solution--------------------
You see what your file code is.
Change Kazakhstan


And then look at what your code file encoding is for the transformation ha
------Solution--------------------
Or the code, the length of 0 is odd.
------Solution--------------------
Five yards without the truth, post code to see.
------Solution--------------------
Verify that your values are passed in ...
------Solution--------------------
I've seen it before. Two values in the page output look like the comparison is returned false
But my situation is not the same, my "bad" value is because after a layer of packaging and then unpacking the transmission, only deterioration.
Since the bad value strlen is very long, I will use trim () to remove the space after the comparison to return true. LZ of the more strange Direct is 0 LZ and compare it with GetType dump output to see what is different ~
------Solution--------------------
Is the value not passed over, carefully examined under the look,
If you can, take the code.
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.