Re: Ive lost a zero somewhere
| From: | Dimitri Marshall | Date: | Thu, 06 Nov 2003 05:04:20 +0000 |
| Subject: | Re: Ive lost a zero somewhere | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-168672@lists.php.net to get a copy of this message | ||
$price = 25;
$f_price = sprintf("%01.2f","$price");
echo "$f_price<br>";
This will give you 25.00 instead of 25. Maybe put your result into a
variable and then convert it into the decimal number using the sprintf()
function.
Dimitri Marshall
"Richard Cook" <web@nwmbrand.com> wrote in message
news:20031106030329.59886.qmail@pb1.pair.com...
> I have a problem with the following
>
> when i multiply for example 25 . 50 * 3 i get 76 . 5 how would i get PHP
to
> recognise the last 0 ie make it 76 . 50
>
> Any ideas?
>
>
> Regards
>
> R