**EDIT**
sorry completely missed this part
QUOTE
so I can't just use the round() function.
However i tested round() on numbers like "5.11" and as ive posted below by rounding to three decimals it will do nothing to change the number unless it ends in a zero in which case it simply strips the zero and nothing more. which explains why this posts assumes you dont understand round();! sorry! But ill leave it as it is for other people to read and hopefully it will be a good solution to your problem

**/ edit***
there is a built in function called round(); which i just found in the php manual, link:
http://uk2.php.net/roundBasically it rounds any decimal number to a spcified number of digits after the decimal point, eg:
QUOTE
round(*NUMBER*, *DECIMAL PLACES*);
round(3.001, 3);
this would output "3.001" because it ends in a one and is being rounded to three decimal places therefore nothing is changed as it already is 3 DP's
round(3.010, 3);
This would give "3.01" as you can see the last zero has been stripped.
there is a limit to this function though because it cant handle numbers containg commas such as "1,000.32" so providing your numbers arent formatted with commas for every thousand and million etc...you will be fine to use this function. The link i gave also has a lot of info in the case your numbers are formatted with commas.
Reply