MrXander Posted September 22, 2012 Share Posted September 22, 2012 Hi Guys, This might be a really dim question, but I need assistance with the round() function. I am trying to show a rounded figure of, for example $3.50, but using round, it is dropping the last zero. The line of code being used is: $price1 = round($personal1 * $rate, 2); Is there anyway to avoid this and display the last zero? Thank you! Link to comment https://forums.phpfreaks.com/topic/268658-help-with-round/ Share on other sites More sharing options...
kicken Posted September 22, 2012 Share Posted September 22, 2012 Use number_format instead of round. Link to comment https://forums.phpfreaks.com/topic/268658-help-with-round/#findComment-1379988 Share on other sites More sharing options...
ManiacDan Posted September 22, 2012 Share Posted September 22, 2012 Note that number_format is only to be used immediately before printing. Don't do additional math on a number which has been formatted. Link to comment https://forums.phpfreaks.com/topic/268658-help-with-round/#findComment-1379996 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.