32至64位的“ Gotchas”在PHP中 [英] 32 to 64 bit "Gotchas" in PHP

查看:93
本文介绍了32至64位的“ Gotchas”在PHP中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

上个周末,我更改了网站的虚拟主机。我所在的主机服务器是32位操作系统,而我移到的主机服务器是64位。出乎意料的是,我的某些PHP脚本开始出现错误的结果。

Last weekend I changed webhosts for my website. The host server I was on was a 32-bit OS and the one I moved to is 64-bit. Unexpectedly, some of my PHP scripts started giving incorrect results.

在我的情况下,<<罪魁祸首是>>和>>(移位)操作。我最终不得不用0xFFFFFFFF屏蔽结果,然后更改结果是否为负值才能像以前一样工作。

In my case the << and >> (bit shift) operations were the culprit. I ended up having to mask the result with 0xFFFFFFFF and then changing the result if negative for it to work as it did before.

我的PHP中是否还有其他可能的问题我应该寻找的脚本?

Are there any other possible problems in my PHP scripts I should look for?

推荐答案

这是一种高级语言,因此任何与位无关的东西(按位运算符,位移)都将一样。

It's a high level language, so anything non-bit related (bitwise operators, bitshift) will be the same.

这篇关于32至64位的“ Gotchas”在PHP中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆