<?
var_dump(1 == "1 dog"); // true
var_dump(1 == "1 cat"); // true
var_dump("1 cat" == "1 dog"); // false
var_dump(1 == "0x1 dog"); // true
var_dump("1 dog" == "0x1 dog"); // false
Result:
bool(true)
bool(true)
bool(false)
bool(true)
bool(false)
Transitivity is none of the things that the "==" operator respects at all. Using the "===" comparator works (in this case). Yet I find this thing funny.
No comments:
Post a Comment