var_export('as1223' == 0); // true ;)
It seems to me alone that this is not true?
There are a lot of illogical things in php, if you hope that it will guess your thoughts. Do not compare variables of different types. And if you compare, then please kindly study exactly how the interpreter does the casting.
In this case, the string is converted to a integer, and then the comparison occurs. Therefore, for example, the expression
var_export('1as1223' == 0);
will already be false.
Conclusion
Always first type the types if you are comparing different types of data.
That's right, when performing a comparison operation, both parties are reduced to a single type in this case, the int is obtained (int) "as1223" is 0, so the equality 'as1223' == 0 is true. At the same time, 'as1223' == ' 0 'returns FALSE, since both operands are strings.
Source: https://ru.stackoverflow.com/questions/167597/
All Articles
==
useless." - drdaeman