Re: formating numbers
| From: | Marcelo Gulin | Date: | Mon, 18 Dec 2000 19:40:49 +0000 |
| Subject: | Re: formating numbers | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-30901@lists.php.net to get a copy of this message | ||
Hi Paul!
try
$a = 1678.34589;
print( number_format( $a, 2 ) ) ;
good luck
Marcelo Gulin
Paul Fontenot escribió:
> I have some pages that that produce output like this:
>
> 36.1367254
>
> My question is, how would I go about changing that to
>
> 36.14 ?
>
> The code is posted below
>
> If (!$submit)
> {
> }
> elseif (!$bore)
> {
> print "<B>Please enter bore in inches.</B>";
> }
> elseif (!$stroke)
> {
> print "<B>Please enter stroke in inches.</B>";
> }
> elseif (!$chamber_vol)
> {
> print "<B>Please enter stroke in inches.</B>";
> }
> elseif ($submit)
> {
> $pi = 3.14;
> $cyl_vol = (($pi/4) * (($bore * 2.54) * ($bore * 2.54)) * ($stroke *
> 2.54));
> $comp_ratio = (($cyl_vol + $chamber_vol)/$chamber_vol);
>
> print "<B>Based on a <font color=teal>$bore</font> inch bore,
> ";
> print "and a <FONT COLOR=TEAL>$stroke</FONT> inch stroke,
> <BR>";
> print "your compression ratio is <FONT
> COLOR=TEAL>$comp_ratio</FONT>:1</b>";
> }
>
> Paul Fontenot
> PitBull Racing.com
> http://www.pitbull-racing.com
>
> --
> 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