<?php
echo (2884284 >> 16), '<br>'; // = 44
echo ((2884284 >> 16) & 0xFFFF), '<br>'; // 44
from the above i got 44
so how can i retrive from 44 to 2884284 ???
<?php
echo (2884284 >> 16), '<br>'; // = 44
echo ((2884284 >> 16) & 0xFFFF), '<br>'; // 44
from the above i got 44
so how can i retrive from 44 to 2884284 ???
To expand on mhughes answer:
2884284 in binary is:
1011000000001010111100
When you shift to the right, bits to the right are cut off, and bits on the left are filled with 0. So 2884284 >> 16
becomes:
0000000000000000101100
...which, as you mentioned, is 44. Notice this is the same as dividing by 2^16 and rounding down. The reverse operation is <<
, or bit shift left. It cuts off bits on the left and fills in bits on the right with zero. But 44 << 16
is:
1011000000000000000000
...that is, you lost the data from the truncated bits. This number is 2883584, which maybe is close enough. Note this is the same as multiplying by 2^16.