PHP’s “boolval”
Everyone loves to dump on Javascript because of stupid things like [] == ![]; // -> true
. Some languages are much better at this. But PHP is not among them. I found the following not quite what I would have expected:
boolval("1"); // returns true
boolval("0"); // returns false
boolval(1); // returns true
boolval(0); // returns false
boolval("00"); // returns true
boolval("0.0"); // returns true
boolval(0.0); // returns false
Leave a Reply