On Fri, 3 Oct 2003 15:51:59 +1000, you wrote:
>Im trying to retrieve the unsigned value of an integer. sounds pretty simple...
>
>[code]
>$i = -86;
>echo "" . sprintf("%d", $i);
>echo "" . sprintf("%u", $i);
>[/code]
>
>produces:
>-86
>4294967198
>
>what i expected:
>-86
>86
>
>Ive searched the ar
* Thus wrote Cody Phanekham ([EMAIL PROTECTED]):
> Im trying to retrieve the unsigned value of an integer. sounds pretty simple...
>
> [code]
> $i = -86;
> echo "" . sprintf("%d", $i);
> echo "" . sprintf("%u", $i);
> [/code]
>
> produces:
> -86
> 4294967198
>
> what i expected:
> -86
> 86
>
>
s [mailto:[EMAIL PROTECTED]
>> Sent: Friday, 3 October 2003 16:27
>> To: Tom Rogers
>> Cc: Cody Phanekham; [EMAIL PROTECTED]
>> Subject: Re[2]: [PHP] unexpected results using sprintf() with %u
>>
>>
>> Hi,
>>
>> TR> -86 actually looks lik
Rogers
> Cc: Cody Phanekham; [EMAIL PROTECTED]
> Subject: Re[2]: [PHP] unexpected results using sprintf() with %u
>
>
> Hi,
>
> TR> -86 actually looks like FFAA which if you then look
> at unsigned is pretty
> TR> big :)
>
> TR> --
> TR> regard
Hi,
TR> -86 actually looks like FFAA which if you then look at unsigned is pretty
TR> big :)
TR> --
TR> regards,
TR> Tom
Maybe what you need is the abs() function which ignores the sign of a number
--
regards,
Tom
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:
Hi,
Friday, October 3, 2003, 3:51:59 PM, you wrote:
CP> Im trying to retrieve the unsigned value of an integer. sounds pretty simple...
CP> [code]
CP> $i = -86;
CP> echo "" . sprintf("%d", $i);
CP> echo "" . sprintf("%u", $i);
CP> [/code]
CP> produces:
CP> -86
CP> 4294967198
CP> what i expected
Im trying to retrieve the unsigned value of an integer. sounds pretty simple...
[code]
$i = -86;
echo "" . sprintf("%d", $i);
echo "" . sprintf("%u", $i);
[/code]
produces:
-86
4294967198
what i expected:
-86
86
Ive searched the archives but most of the messages refer to %s or %d... nothing in
7 matches
Mail list logo