Is that OK? How to solve it

Source: Internet
Author: User
Is that OK?
All the letters of the string and 0 are identical? Ask for explanations
PHP Code
  
   if ("e" = = 0) {    echo "Yes";} #result: #Yes


------Solution--------------------
"E" is not a variable in memory, nothing ....
------Solution--------------------
This by:
PHP code
echo "e" = = = 0; 
------Solution--------------------
PHP will automatically convert the type of the variable, and the int and string comparisons will then convert the string to int so that all the strings are 0, then the result is OK, you can use = = = Congruent to determine
------solution--------------------
To resolve more clearly:

Echo intval (' e '); #转换不成功, default 0 (print:0)
Echo intval (' 1ds2e '); #字符串中有整数出现, take the first occurrence of the position, convert to int (print:1)

discussion

this way:php c Ode
echo "e" = = = 0;

------Solution--------------------

This is wrong, "there are integers in the string, then take the first occurrence and convert to int (print:1)"
The
should look like this:

An integer appears in the string, and the integer at the beginning of the string is taken out, converted to an int

discussion

To resolve this more clearly:

Echo intval (' e '); #转换不成功, default 0 (print:0)
Echo intval (' 1ds2e '), #字符串中有整数出现, take first occurrence, convert to int (print:1)

Reference:

This way:php code
echo "e" = = = 0;
  • 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.