$uid = 1346563572;
echo strlen($uid); // 10
echo strlen(pack(‘s’,$uid)); // 2
echo strlen(pack(‘i’,$uid)); // 4
echo strlen(pack(‘N’,$uid)); //4
$i = 333333333333333333;
$v = pack(“NN”,$i >> 32,$i&0xFFFFFFFF);
file_put_contents(“/tmp/long.txt”,$v);
echo strlen($v)
$v = file_get_contents(“/tmp/long.txt”);
list ($hi,$lo) = array_values(unpack(“N*N*”,$v));
if ($hi <0) $hi += (1 < < 32);
if ($ho <0) $lo += (1 << 32);
echo ($hi << 32) + $lo;
欢迎光临 仓酷云 (http://ckuyun.com/) | Powered by Discuz! X3.2 |