Re: How do I reformat a decimal no. to show just 2 decimal places?
| From: | Data Driven Design | Date: | Wed, 28 Jun 2000 22:35:19 +0000 |
| Subject: | Re: How do I reformat a decimal no. to show just 2 decimal places? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-3687@lists.php.net to get a copy of this message | ||
number_format($sum1,2);
or you can use printf()
Data Driven Design
P.O. Box 1084
Holly Hill, FL 32125-1084
Phone : (904) - 226-8979
URL : http://www.datadrivendesign.com
URL : http://www.rossidesigns.net
----- Original Message -----
From: Gareth Mulholland <Gareth@rusholme.com>
To: <php-general@lists.php.net>
Sent: Wednesday, June 28, 2000 6:15 PM
Subject: [PHP] How do I reformat a decimal no. to show just 2 decimal
places?
> I've got a script which does some maths and produces a variable
>
> $sum1
>
> Usually , when printed direct to the screen the variable looks something
like:
>
> 124.283838277
>
> What do I have to do to round it to the 2nd decimal place to look like
>
> 124.28
>
> Thanks
> Gareth Mulholland
>
>
>
> --
> 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
>