View Full Version : Rounding this number

11-24-2010, 02:35 AM
I have a echo string that averages the numbers in a database. However it is giving me too many decimals, I only need and want two decimals after the whole number. So I am getting numbers like 2.6666666666667

The string I have echoing it looks like this

<?php echo (($row_rsRATE2['Avg(rating)'])); ?>

Is there something I can add to the echo string to get it to round to the nearest hundreth. So it looks like 2.67

11-24-2010, 03:11 AM
echo round($row_rsRATE2['Avg(rating)'], 2); should do it