I pulled this result from here:
And interestingly, the result of
var_dump((int)(PHP_INT_MAX + 1))
will be displayed as a negative number (in the case of this specific example, it will displayint(-9223372036854775808)
). Again, the key here is for the candidate to know that the value will be displayed as a negative number.
Is the int negative because adding 1 will overflow the integer bits and change the bit representing the sign of the int? What's the reason?