Re: stripping negative number
| From: | Justin England | Date: | Thu, 23 Dec 2004 09:16:55 +0000 |
| Subject: | Re: stripping negative number | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-205047@lists.php.net to get a copy of this message | ||
unsigned does not equal absolute value.
$num = -40;
print "Num: $num\n";
$num = abs($num);
print "ABS: $num\n";
will display:
Num: -40
ABS: 40
http://us2.php.net/manual/en/function.abs.php
Justin
----- Original Message ----- From: "Roger Thomas" <sniper@home.net.my>
To: <php-general@lists.php.net>
Sent: Thursday, December 23, 2004 1:18 AM
Subject: [PHP] stripping negative number
I want to convert negative number to its positive equivalent. $num = -40; printf("Unsigned value is %u", $num); output is: Unsigned value is 4294967256 I have checked the manpages and %u seems the right format. Pls advise. -- roger --------------------------------------------------- Sign Up for free Email at http://ureg.home.net.my/ --------------------------------------------------- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php