Hey Dave,
It is much easier to use hex numbers when working with bits. Thus, the mask
for the first (left) "quartet" would be 0xF000,
second 0x0F00, third 0x00F0 and fourth 0x000F. To apply the mask use binary
AND operator, which is "&" in case of PHP.
After applying the mask you need to "shift-r
Well, to begin with applying the mask to 1101 0100 0110 0110 is
going to give you 110 not 110. But you can shift the result to the
right 4 if that is the result you want. There is no algorithm to speak
of here, just apply the mask. Like this:
$num = "1101010001100110";
$
2 matches
Mail list logo