The strcmp comparison result is always not 0.

Source: Internet
Author: User
Php string comparison problem. it looks like it is clear that the strcmp comparison result is never 0. input & nbsp; id value from the page is 1 & nbsp ;, one is that the id value read from the file is 1, which is always different when compared with strcmp. Then, use strlen to test the string length & nbsp; the length of the input 1 is actually 0, php string comparison problem. it looks like it is clear that the strcmp comparison result is always not 0
The input id value from the page is 1,
The id value read from the file is 1.
The length of 1 passed in by strcmp is always different. Then, use strlen to test that the length of 1 passed in is 0, and the length of 1 read from the file is 1. currently, this is caused by inconsistent encoding. but how can I set it? Please advise. thank you.
------ Solution --------------------
Let's take a look at the encoding of your file.
Transformation


Then, let's see what the encoding of your code file is.
------ Solution --------------------
It still depends on the code. it is strange that the length is 0.
------ Solution --------------------
Five yards without the truth, paste the code to see it.
------ Solution --------------------
Confirm that your value is passed in...
------ Solution --------------------
I have encountered before that, when two values appear the same in the page output, false is returned for comparison.
However, my situation is different. The value of my "deterioration" is deteriorated only after packaging and re-unpacking and transmission.
Because the deteriorated value strlen is very long, I use trim () to remove spaces for comparison to return true. the strange LZ is that it is 0 and LZ is used for comparison. use the gettype dump output to see what is different ~
------ Solution --------------------
If the value is not passed in, check it carefully,
If you can, let's take a look at 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.