learn php:Rounding and Formatting NumbersPHPMA.COM
Round () - Rounding Numbers
The PHP function round () is used to round numbers up or down based on their value (Any decimal .5 or above is rounded up, anything under .5 is rounded down.) You can specify how many decimals you would like the number rounded to. It is phrased as round ( number, optional_decimals ) If left unspecified, by default it will round to the nearest whole number. You can use negative numbers when specifying the optional_decimals, for example -1 would round to the nearest 10, -2 would round to the nearest 100, etc. PHPMA.COM
<?php
echo round(3.14159265);
// Value would be 3echo round(3.9);
// Value would be 4echo round(3.14159265, 3);
// Value would be 3.142echo round(314159, -100);
// Value would be 314100
?> PHPMA.COM


