Re: Working with numbers
| From: | Gyozo Papp | Date: | Thu, 03 May 2001 12:05:28 +0000 |
| Subject: | Re: Working with numbers | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-51257@lists.php.net to get a copy of this message | ||
what about function round() with precision argument ?
check it:
for ($i = 0; $i < 10; $i += 0.25) {
echo round($i,2). "<br>";
}
----- Original Message -----
From: "Jennifer" <toxlists@canada.com>
To: <php-general@lists.php.net>
Sent: 2001. május 3. 08:53
Subject: [PHP] Working with numbers
> I have a shopping cart that allows decimal points for quantities.
> I like it like that, but would like to remove any trailing zeros
> and if the quantity is not a fraction I would like to remove the
> decimal point too.
>
> What would be the easiest way to do this? I don't see any
> function that would make it easy.
>
> Jennifer
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>