Re: New to list
| From: | hugh danaher | Date: | Fri, 11 Jan 2002 08:30:06 +0000 |
| Subject: | Re: New to list | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-80173@lists.php.net to get a copy of this message | ||
try
$total=((0.416 / $time) * 60) * 60);
$output=number_format($total,2,'.',','); / / uses comma separators between
thousands and a decimal point between the units and tenths.
or
$output=number_format(((0.416 / $time) * 60) * 60),2,'.',','); / / php is
usually forgiving on combined operations.
number_format() truncates the number so if you have 1.209 it will lop of the
last number resulting in 1.20. if you want a rounded number use round().
both commands are in the online manual.
hope this helps.
Hugh
----- Original Message -----
From: Andrew <andrew@therapids.net>
To: <php-general@lists.php.net>
Sent: Thursday, January 10, 2002 4:05 PM
Subject: [PHP] New to list
> Hello to you all!
> I am new to this list and I have a question that maybe someone can help
with
>
> In a script I am working on I have a math's equation :
>
> ((0.416 / $time) * 60) * 60)
>
> this out but a figure at goes to a about 10 decimal places I only want 2
> decimal places and just can not figure out how to do this
>
> Any ideas would be great
>
>
> Thanks
>
> Andrew
> Web Harper Graphics
> www.webharpergraphics.com
>
>
>
>