Location: PHPKode > scripts > Convert a 64 bit number > convert_64Bit.php
//function to convert a 64 bit number
function convert_64Bit ($str)
{
     $str = (string) $str;
     while (!preg_match('/^0*$/', $str) && $j < 65)
     {
         $start_value = '';
         $remainder = '';
         //loop through the length of the number
         for ($count = 0; $count < strlen($str); $count++)
         {
             //check the value of our start_value, if it's
             //empty we need to keep looping
             if ($start_value == '')
             {
                 //check the value of our values divided by 2
                 if (floor(($str[$count] + $remainder) / 2))
                 {
                      $start_value .= floor(($str[$count] + $remainder) / 2);
                 }
             }
             else
             {
                 $start_value .= floor(($str[$count] + $remainder) / 2);
             }
             $remainder = $str [$count] % 2 * 10;
         }
         //assign our temp variable ($x) with the value of
         //$remainder value divided by 10
         $x = floor($remainder / 10);
         $final_value .= $num;
         $str = $start_value;
         $j++;
     } 
 return $final_value;
}
Return current item: Convert a 64 bit number