Problem with wanting something NOT to round

From: Date: Fri, 17 Nov 2006 10:02:27 +0000
Subject: Problem with wanting something NOT to round
Groups: php.general 
Request: Send a blank email to php-general+get-244787@lists.php.net to get a copy of this message
Hi, 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? MTIA George

« previous php.general (#244787) next »