LOL Booleans (21)

5 Name: #!/usr/bin/anonymous : 2008-03-27 22:27 ID:Kv5U8BIj

Java raises an error as well (operator + cannot be applied to boolean,boolean), and so does Scheme.

It's also worth noting that PHP does have a real boolean type, it's just that when adding them, the variables automatically get cast to integers (with value 1) and added, and any non-zero integer (2 in this case) evaluates to true as well.
Casting the sum to a boolean and back will also give you 1, not 2.

PHP's type system is hilarious.

This thread has been closed. You cannot post in this thread any longer.