What's Here?
- Members: 131,956
- Replies: 470,233
- Topics: 72,881
- Snippets: 2,538
- Tutorials: 664
- Total Online: 1,995
- Members: 86
- Guests: 1,909
Who's Online?
|
This is a function to convert a 64 bit number since base_convert will choke on a number that size
|
Submitted By: PsychoCoder
|
|
Rating:
  
|
|
Views: 7,312 |
Language: PHP
|
|
Last Modified: March 9, 2008 |
|
Instructions: Pass the function you wish to convert |
Snippet
//function to convert a 64 bit number
function convert_64Bit ($str)
{
$str = (string) $str;
{
$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;
}
Copy & Paste
|
|
|
Reference Sheets
Bye Bye Ads
Free DIC T-Shirt
Related Sites
Monthly Drawing
Partners
Top Contributors
Top 10 Kudos This Month
|