[PHP2] ECHO Format
| From: | Jo Ann Comito | Date: | Fri, 23 Jun 2000 12:49:18 +0000 |
| Subject: | [PHP2] ECHO Format | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-2778@lists.php.net to get a copy of this message | ||
Hi,
I'm new to the list and to PHP, but this is an old question. I hope some
of you have good memories.
The isp which hosts the site I am working on only has PHP ver 2
installed.
I have a variable $Total which is the sum of various prices. When I
display $Total using ECHO I get a lot of extra zeroes. For example, I
get 12345.0000000000 instead of 12345.00.
How can I format the ECHO command to give me only 2 decimal places?
I posted this question on the phpbuilder forum, but the only response I
got was to use printf instead of echo. Unfortunately, PHP 2 does not
have a printf function. Anyone remember back to PHP 2 and can answer
this?
Thanks,
Jo Ann