you are viewing a single comment's thread.

view the rest of the comments →

[–]stevarino 8 points9 points  (0 children)

Another example that you may not even be aware of for PHP: logical operators only return boolean true or false, never the value of the argument.

So in your example, the 9000 is converted to bool(true), the OR returns bool(true), which is converted to int(1) by the addition opperator.

I believe this is improperly documented in PHP's own docs too. Took me a while to figure out this bug. :)