Why is var_dump ((int) (PHP_INT_MAX + 1)) negative?

I pulled this result from here :

And interestingly, the result var_dump((int)(PHP_INT_MAX + 1))

will display as a negative number (in the case of this particular example, it will display int(-9223372036854775808)

). Again, the key here is for the candidate to know that the value will be displayed as a negative number.

Is int negative because adding 1 overflows the integer bits and changes the bit that represents the sign of the int? What reason?

+3


source to share





All Articles