今天某同事碰到了一個php在32bit/64bit行為不同的例子:

主要是 dechex 跟 integer 位數問題, 請參考
http://tw2.php.net/manual/en/function.dechex.php

To force the correct usage of 32-bit unsigned integer in some functions, just add '+0' just before processing them.

for example
echo(dechex("2724838310"));
will print '7FFFFFFF'
but it should print 'A269BBA6'

When adding '+0' php will handle the 32bit unsigned integer
correctly
echo(dechex("2724838310"+0));
will print 'A269BBA6'

arrow
arrow
    全站熱搜

    Izero 發表在 痞客邦 留言(0) 人氣()