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
php


source to share


No one has answered this question yet

Check out similar questions:

4270
Link. What does this symbol mean in PHP?
2414
Why shouldn't I use the mysql_ * functions in PHP?
1065
Link. What does this error mean in PHP?
577
How can I capture the var_dump result into a string?
319
What is PHP's Python equivalent of var_dump ()?
282
php var_dump () vs print_r ()
6
PHP - unpack as unsigned int
1
Limit memory exceeds limit
1
Reliable detection of integer / downstream overflow
0
Correct binary representation for PHP_INT_MAX + 1 with which bitwise operations are performed in PHP?



All Articles
Loading...
X
Show
Funny
Dev
Pics