/*************************************************<a>2本文来源gao*daima.com搞@代#码&网6</a><pre>搞gaodaima代码
*****
* 逐bit的低位在前算法
* @param $x
* @return int
*/
function reverse($x)
{
$result = 0;
for($i = 0; $i < 8; $i++)
{
$result = ($result <> $i));
}
return $result & 0xff;
}
调用展示:
$testData = 0xC5; //二进制:1100 0101<BR>$testRet = reverse($testData);<BR>echo $testRet; //输出值为163,二进制为1010 0011<BR>
