Addition (+
) implicitly casts both operands to float
if either one of them is float
, otherwise both operands are cast to int
(See paragraph #2.)
It seems that, at least for now, an object
cast to int
results in the value 1
, hence the result 1000 + 1 = 1001
or 1 + 1000 = 1001
, however, per the documentation, the behavior is undefined and should not be relied upon.
If you've turned on E_NOTICE
error reporting, a notice should also be produced, saying that object could not be converted to int.