unexpected results using sprintf() with %u
| From: | Cody Phanekham | Date: | Fri, 03 Oct 2003 05:51:59 +0000 |
| Subject: | unexpected results using sprintf() with %u | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-164853@lists.php.net to get a copy of this message | ||
Im trying to retrieve the unsigned value of an integer. sounds pretty simple...
[code]
$i = -86;
echo "<br>" . sprintf("%d", $i);
echo "<br>" . 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 regards to %u
can anyone see what im doing wrong?
Im using PHP 4.3.2
TIA
Cody
*************************************************************************************
This e-mail, including any attachments to it, may contain confidential and/or personal information.
If you have received this e-mail in error, you must not copy, distribute, or disclose it, use or
take any action
based on the information contained within it.
Please notify the sender immediately by return e-mail of the error and then delete the original
e-mail.
The information contained within this e-mail may be solely the opinion of the sender and may not
necessarily
reflect the position, beliefs or opinions of Salmat on any issue.
This email has been swept for the presence of computer viruses known to Salmat's anti-virus
systems.
For more information, visit our website at www.salmat.com.au.
*************************************************************************************