Bitwise operations PHP and JS different [duplicate]

独自空忆成欢 提交于 2021-02-11 12:29:37

问题


Why does php and js give different results to the same thing: JS:

1085 << 24 = 1023410176

PHP:

1085 << 24 = 18203279360

回答1:


The operands of a bitwise operation in JavaScript are always treated as int32, and in PHP this is not the case.

And in PHP, the bits do not get truncated because it is not treated as a 32-bit integer.

Difference in the results of operations bitwise between javascript and php



来源:https://stackoverflow.com/questions/50518081/bitwise-operations-php-and-js-different

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!