PHP, Bitwise operation, not negative -


when trying code in php:

$result = 4 << 29; var_dump($result); // int(2147483648) 

but in other languages, example in java or javascript -2147483648. why?

this depends on php version you're running. while ago there bug in 32-bit int math when comes overflows. has been solved in php 5.3.


Comments

Popular posts from this blog

angularjs - Showing an empty as first option in select tag -

qt - Change color of QGraphicsView rubber band -

c++ - Visible files in the "Projects" View of the Qt Creator IDE if using the CMake build system -