in reply to Re^3: How to convert binary to hexadecimal
in thread How to convert binary to hexadecimal
Good stuff, thanks a lot.
However, the line $hex = sprintf... better works as follows:
$hex = sprintf('%0' . $WIDTH * 2 / 8 . 'X', oct("0b$cut_string")) . $h +ex;
This covers cases when there are long sequences of zeroes in binary strings.
|
|---|