Jump to content

Number formatting and decimal places


12dstring

Recommended Posts

I have a field in my database which has numbers varying from 0.35 to 60000, and when I output them on my php page, I want the decimal places on the small ones to be shown, but without the large ones appearing with them, ie 60000.00.

I've tried all of the different formats, float, decimal, double... but they all seem to either cut the decimals off or have them all on.

 

Is there one which automatically cuts off extra zeros after the decimal place?

 

Thanks,

Dave

Link to comment
https://forums.phpfreaks.com/topic/48968-number-formatting-and-decimal-places/
Share on other sites

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.