Giddy Rob Posted May 28, 2008 Share Posted May 28, 2008 Hi, I have created a shopping cart, which adds and subtracts the value of an item the more or less the customer has in their cart. The problem is is that I would like it to show two digits after the decimal point, but it just chops of the .*0 or .00. If the result is 19.95 that is fine but if its 19.00 it outputs just 19. If the result is 19.90 it just outputs 19.9. What do I need to do to create the extra 0/0's if necessary? Cheers Rob Link to comment https://forums.phpfreaks.com/topic/107585-zeros-after-decimal-point-money/ Share on other sites More sharing options...
corbin Posted May 28, 2008 Share Posted May 28, 2008 http://us.php.net/manual/en/function.money-format.php Link to comment https://forums.phpfreaks.com/topic/107585-zeros-after-decimal-point-money/#findComment-551435 Share on other sites More sharing options...
Giddy Rob Posted May 28, 2008 Author Share Posted May 28, 2008 Hi, thanks for the response but for some reason the money function messed up the shopping cart, which seems very strange when all it appears to do is reformat the array value for outputting to the screen. I have used the number_format() function and this seems to work perfectly. Any clues why this might cause a problem? Cheers Rob Link to comment https://forums.phpfreaks.com/topic/107585-zeros-after-decimal-point-money/#findComment-551491 Share on other sites More sharing options...
PFMaBiSmAd Posted May 28, 2008 Share Posted May 28, 2008 Any clues why this might cause a problem? Not unless you would kindly post the code that did not work using money format function and the code using the number_format() function so that someone could see what you changed that was not correct. Link to comment https://forums.phpfreaks.com/topic/107585-zeros-after-decimal-point-money/#findComment-551644 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.