Copy the Code code as follows:
The value to be taken into the system position
function Getremainder ($num, $bin, $pos, & $result = 0) {
Author Lianq.net
$num Value, Decimal
$bin the binary to convert
Number of $pos digits
$real _len = log ($num, $bin);//logarithm, calculate the length of the original value
$floor _len = Floor ($real _len);//to seek the whole
$base = Pow ($bin, $pos-1);//Cardinality
$divisor = Pow ($bin, $pos);//divisor
if ($num >= $divisor) {
$new _num = $num% pow ($bin, $floor _len);
Getremainder ($new _num, $bin, $pos, $result);
}else{
$result = Floor ($num/$base);
}
return $result;
}
For example, when the value 16 is converted to 9, what is the value on the first bit?
$a = Getremainder (16,9, 1);
echo $a;//Output 7
The above describes the 0x00000050 computer blue screen code PHP to take the remainder function code, including the 0x00000050 computer blue screen code content, I hope that the PHP tutorial interested friends helpful.