Guest User

Untitled

a guest
Aug 11th, 2011
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.37 KB | None | 0 0
  1. $max = 4294967295;
  2.  
  3. function dhex($val){
  4. global $max;
  5. $rest = $val;
  6. $string = "";
  7. while (true) {
  8.   if ($rest > $max) {
  9.    $quotient = $rest/$max;
  10.    $int = floor($quotient);
  11.    $num = $quotient-$int;
  12.    $rest = $int;
  13.    $string = dechex($num) . $string;
  14.   } else {
  15.    $string = dechex($rest) . $string;
  16.    break;
  17.   }
  18. }
  19. return $string;
  20. }
  21.  
  22. echo dhex(979797565656);
Advertisement
Add Comment
Please, Sign In to add comment