Re: How do I get the result of a Division to 2 decimal places?
| From: | Marco Schuler | Date: | Tue, 09 Sep 2003 14:30:08 +0000 |
| Subject: | Re: How do I get the result of a Division to 2 decimal places? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-162064@lists.php.net to get a copy of this message | ||
Hi
Am Die, 2003-09-09 um 16.06 schrieb Shaun:
> Hi,
>
> I am dividing a number by another number and printing the result to the
> screen. How can I ensure that the number is rounded up to 2 decimal places?
Use printf with format strings like printf("Value: %.2f", $value);
http://php.net/manual/en/function.printf.php
--
Marco