/******************************************************
* 逐bit的低位在前算法
* @param $x
* @return int
*/
function reverse($x)
{
$result = 0;
for($i = 0; $i {
$result = ($result > $i));
}
return $result & 0xff;
}
调用展示:
$testData = 0xC5; //二进制:1100 0101
$testRet = reverse($testData);
echo $testRet; //输出值为163,二进制为1010 0011
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn