In PHP, variables are stored in a C-language structure. empty strings, NULL strings, and false are both stored with a value of 0.
The above sentence is correct.
------ Solution --------------------
Php is a weak language.
So when you change
Echo false = 0? "True": "false"; // outputs true
It is also true, so you can't simply judge '0' to say that it is a string type, because you use =
It does not compare the types
If you want to judge whether the string 0 is
Echo false = '0 '? "True": "false"; // outputs false
Discussion
Is false a string?
Why echo false = '0 '? "True": "false"; // outputs true
Reference:
'0' is a string. if it is null = "", it will be true.
------ Solution --------------------
Come and read the manual with me ....
Http://ca.php.net/manual/en/language.operators.comparison.php
Intermediate Comparison with Various Types table ....
For comparison of different types of variables, type conversion is required first, and how conversion determines the final result ....
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