RE: Problem with wanting something NOT to round

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> George Pitcher wrote:
> > As part of a result from a web-service call, I get a price in
> dollars and
> > cents as a decimal number eg.160.44 (the example I am working on.  This
> > price is for permission to re-use some published material and for each
> > additional separate pagerange, $3 needs to be added afterwards.
> >
> > So I have the following code in my script:
> >
> > $range = explode(",",$pr);
> > $rangecounter = count($range);
> > $rangecounter = ($rangecounter>1?$rangecounter-1:0);
> > $ccc_supp =  floatval($rangecounter * 3);
> > $fee2 = floatval($fee + $ccc_supp);
> > echo sprintf("%01.2f",$fee2);
> >
> > $pr is my pagerange which, in this case is 9-24, generates a
> rangecounter of
> > 1, so does not get any additional $3 added.
> >
> > My echo produces 160, instead of the 160.44 which I want.
> >
> > Can anyone point me in the direction of a solution?
> >
>
> Are you sure the web service is giving you 160.44? I get it displayed as
> expected...
>
>     http://dev.stut.net/php/pitcher.php
>
Hi,

Yes, I am echoing the 160.44 ok. I'm just not getting the 44c in my display
price. I'm on Windows NT - could that be a factor?

George

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux