emma57573 Posted June 30, 2008 Share Posted June 30, 2008 Im trying to times a price of something by quantity which works but I want to keep the price in the same format when Ive printed it. Must be simple but im not sure how to do it. $buy_price=2.50; $qty= 1; $total += $buy_price * $qty; Then I get 2.5 Link to comment https://forums.phpfreaks.com/topic/112673-solved-stop-my-sum-rounding-down-when-multiplying/ Share on other sites More sharing options...
AndyB Posted June 30, 2008 Share Posted June 30, 2008 It's all in how you format the displayed values. These will point you in the right direction: http://ca.php.net/manual/en/function.number-format.php http://ca.php.net/manual/en/function.sprintf.php Link to comment https://forums.phpfreaks.com/topic/112673-solved-stop-my-sum-rounding-down-when-multiplying/#findComment-578642 Share on other sites More sharing options...
emma57573 Posted July 1, 2008 Author Share Posted July 1, 2008 Thank you for those links, Problem solved Link to comment https://forums.phpfreaks.com/topic/112673-solved-stop-my-sum-rounding-down-when-multiplying/#findComment-579305 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.