PHP left shift operation

echo-2 < < 3;
I"m a little surprised that the result is-16

the following is the process of my analysis:
/ /-2 original code: 1000 0000 0000 0010
/ /-2 inverse code: 1111 1111 1111 1101
/ /-2 complement: 1111 1111 1111 1110

/ / < < result: 1111 1111 1111 0000 (complement)
/ / < < result: 1111 1111 1110 1111 (inverse)
/ < < result: 1000 0000 0001 1111 (original code)
so, the result of my analysis is-31

solution, thank you
= update =
how embarrassing. When I inverted the original code, the last four digits were not reversed

.

the last inverse code should not be the same symbol bit, should it be added by 1?


you seem to have miscalculated the original code of
/ /-2: 1000 0000 0000 0010
< < 3: move left three digits
/ / get: 1000 0000 0001 0000
that's-16.

Menu