0 & #039; & #039; I understand it when it was founded. 0 & #039; abc & #039; I don't understand it when it was founded. Please kindly advise! 0 = ''is true. I understand,
0 = 'abc' is also set up and you will not understand it. Please advise!
Reply content:
0 = ''is true. I understand,
0 = 'abc' is also set up and you will not understand it. Please advise!
Aha, I read the relevant article two days ago. This is becauseYou are comparing a number with a string. PHP will convert the string to a number and then compare it..
PHP conversion rules are as follows:If the string starts with a number, the start number is used as the conversion result. If no value exists, 0 is output..
For example:123abc
After conversion, it should be123
, AndAbc
Is0
,0 = 0
This is of course true!
For details, refer to the official manual: If you compare an integer and a string, the string will be converted to an integer.
PS: @ gaosboy'00' = '000'
It is a comparison of two strings, which are also explained in the official manual.
$ A = 'abc'; $ B = (int) $ a; echo $ B; if (0 = $ B) {// Yes}
Run the command and you will know.
I think it's time to take a closer look at the php manual ~~~
If you do not test the var_dump (count ('abcde'), what is the printed result?