如何将int32从array-bytes解析为php int?

时间:2016-04-22 14:23:41

标签: php

有没有一种聪明的方法可以将数组中的字节转换为PHP-int。

//data holding three int32's
$data = array(0,53,100,200,0,0,0,0,10,20,30,40);
$myInt1 = cleverWay($data,0,'big-endian'); //0 = startpoint to parse

//myInt1 should now contain 0 + 53 * 2^8 + 100 * 2^16 + 200 * 2^24
//(there's a glitch here since int32 probably is signed and
//comment above uint32.

0 个答案:

没有答案