Re: formating numbers
| From: | jeremy brand | Date: | Mon, 18 Dec 2000 19:34:52 +0000 |
| Subject: | Re: formating numbers | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-30893@lists.php.net to get a copy of this message | ||
use the number_format() function
http://php.net/number_format
:)
-jeremy
Jeremy Brand :: Sr. Software Engineer :: 408-245-9058 :: jeremy@nirvani.net
http://www.JeremyBrand.com/Jeremy/Brand/Jeremy_Brand.html
for more
Get your own Free, Private email at http://www.smackdown.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
At least for the people who send me mail about a new language that
they're designing, the general advice is: do it to learn about
how to write a compiler. --Dennis Ritchie
On Mon, 18 Dec 2000, Paul Fontenot wrote:
> Date: Mon, 18 Dec 2000 12:37:11 -0700
> From: Paul Fontenot <paul@pitbull-racing.com>
> To: PHP <php-general@lists.php.net>
> Subject: [PHP] formating numbers
>
> 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
>
>