Integer Becomes Negative¶
$a is the largest integer in PHP. So, $b, which is one bigger than $a, is actually a float, which is bigger and still positive. When casting the float to an integer, the integer is turned into a negative number by overflowing.
See Also¶
Larger than integers [Try me]