Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

php losing 2 decimal

$
0
0
i have two number qty_p and price_db. qty_p will be always int. and price_db can be int or double with 2 decimal place.

$qty_p = $_POST['qty'];
$price_db = $row['price'];


on top iam get the value and so far its fine.

but below the php is round the number up and losing the 2 decimals. can any one explain to me why its doing that. is there a function that can i use?

$total = $price_db * $qty_db;

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>