March 13th, 2013, 06:31 PM
Proper use of number_format
I have inconsistent type of prices (int or float) for example:
I want to add .00 in front of all regardless of type. Would this be the right way of doing it?
March 13th, 2013, 06:57 PM
No offense but have you tried it?
March 13th, 2013, 07:39 PM
Yes it works fine but it's always good to check I guess.
Originally Posted by requinix
March 13th, 2013, 08:35 PM
It's fairly straightfoward as far as functions go. You can't use round() because that keeps the result as a number (thus losing any insignificant zeroes); [s]printf() is another option but probably not as good as number_format().