formating numbers
| From: | Paul Fontenot | Date: | Mon, 18 Dec 2000 19:37:11 +0000 |
| Subject: | formating numbers | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-30892@lists.php.net to get a copy of this message | ||
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