* Thus wrote Ren Fournier ([EMAIL PROTECTED]):
> -= PRODUCES: =-
>
> -333371788
> 3961595508
>
>
> Is this something about signed versus unsigned integers? What I really
> would like to do is convert that negative number (-333371788), which I
> suppose is unsigned to a signed integer (3961595508) without having to
> convert it to hex, then back to decimal.
You have it backwords.. -333371788 is signed and the 3961595508 is
unsigned.
But...
<?php
$dec = -333371788;
$unsigned = sprintf("%ul", $dec);
print $unsigned; // == 3961595508
Do note that php doesn't have native unsigned numbers so doing
something like this wont work right:
printf("%d", $unsigned); // == 2147483647
So to convert it back you have to do something like:
printf("%d", $unsigned+0); // == -333371788
Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php