Jump to content

zeros after decimal point - Money


Giddy Rob

Recommended Posts

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

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

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.