Re: [PHP2] ECHO Format Ammendment
| From: | Andy Woolley | Date: | Fri, 23 Jun 2000 13:15:20 +0000 |
| Subject: | Re: [PHP2] ECHO Format Ammendment | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-2786@lists.php.net to get a copy of this message | ||
Try this instead,
echo (number_format($Total, 2));
instead of what I said earlier
echo (number_format($Total), 2);
Andy.
----- Original Message -----
From: "Jo Ann Comito" <jacomito@sprintmail.com>
To: "PHP List" <php-general@lists.php.net>
Sent: Friday, June 23, 2000 1:49 PM
Subject: [PHP-GENERAL] [PHP2] ECHO Format
> 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
>
>
> --
> 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
>
>