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

-Stut

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

Reply via email to