//转16进制
<?php
$mybit = '001000000100000001000111110011110010101101011000000100001011100111000110001000100011101000010110000000110011000001001010001100001000001011100000000101001100111100111001110100010001000010011000111011010011101111001100011101101001000100100010';
$_32hexa = "";
$index = -4;
while (abs($index) <= 240) {
$a = substr($mybit,$index,4);
$index = $index-4;
$_32hexa = base_convert($a, 2, 16).$_32hexa;
}
echo($_32hexa);
return;
?>
//转32进制
<?php
$mybit = '001000000100000001000111110011110010101101011000000100001011100111000110001000100011101000010110000000110011000001001010001100001000001011100000000101001100111100111001110100010001000010011000111011010011101111001100011101101001000100100010';
$_32hexa = "";
$index = -5;
while (abs($index) <= 240) { //多少位 ,默认240位
$a = substr($mybit,$index,4);
$index = $index-5;
$_32hexa = base_convert($a, 2, 32).$_32hexa;
}
echo($_32hexa);
return;
?>