If you're trying to add 2 boolean values you might have other problems in your application.
It is correct that TRUE or FALSE should not be used as constants for the numbers 0 and 1.
But there may be times when it might be helpful to see the value of the Boolean as a 1 or 0. For those wondering why the string "0" is falsy, consider that a good deal of input data is actually string-typed, even when it is semantically numeral.
Ah, yes, booleans - bit values that are either set (TRUE) or not set (FALSE).
Now that we have 64 bit compilers using an int variable for booleans, there is *one* value which is FALSE (zero) and 2**64-1 values that are TRUE (everything else).
It appears there's a lot more truth in this universe, but false can trump anything that's true...
PHP's handling of strings as booleans is *almost* correct - an empty string is FALSE, and a non-empty string is TRUE - with one exception: A string containing a single zero is considered FALSE. If *any* non-empty strings are going to be considered FALSE, why *only* a single zero?
Why not "FALSE" (preferably case insensitive), or "0.0" (with how many decimal places), or "NO" (again, case insensitive), or ... The *correct* design would have been that *any* non-empty string is TRUE - period, end of story.operator has higher precedence than assignment: The code is equivalent to $z=($y OR $x).This is why you should NEVER use the OR operator without explicit parentheses around the expression where it is being used. You may get such a string from your database, if you have columns of type DECIMAL or CURRENCY.In such cases you have to explicitly check if the value is != 0 or to explicitly convert the value to int also, not only to boolean.PHP does not break any rules with the values of true and false.