I am writing an application that calulates the VAT (sales tax to you Americans) on purchases.
It its wisdom the UK goverment sets the rate at 17.5% which produces lots of numbers after the decimal point.
I am using round($price, 2) to round up the values so they are correct mathematically.
However this leaves a presentational problem as a price of one pound 50 pence, for example becomes 1.5 instead of 1.50.
Is there any quick and easy way of trapping numbers with only one decimal place and "padding" them with an extra zero?
I am guess you could use a regexp for this or maybe there is a math function that does this that I am missing.
MrRosary