I want to know what 21712341byte is in the K position, what about the M position, and the G position? This is equivalent to a hexadecimal conversion problem. It’s just that the base system to be converted now is 1024.
//Get the numerical value in the base digitfunction getRemainder($num, $bin, $pos, &$result = 0){ //author lianq.net //$num but the numeric value in decimal digits - function getRemainder($num, $bin, $pos, &$result = 0){ /$bin The base to be converted
- //$pos The number of digits
- To find the integer
- $new_num = $num % pow($bin, $floor_len);
- $remainder($new_num, $bin, $pos, $result);
- }else{
- $result = floor($num / $base);
- }
- return $result;
- }
-
- //For example, when the value 16 is converted to base 9, what is the first digit of it?
- $a = getRemainder(16,9, 1);
- echo $a;//Output 7
-
-
-
- Copy code
-
-
-
-
-
|