PHP round() - Math Functions
What is round Function?
Explanation
The "round()" function is used to round a float value to the nearest integer.
Syntax:
round(x,precision)
In the above syntax "x" is the floating number and "precision" specifies the number of digits after the decimal.
Example :
<?php
echo round(5.4);
echo round(5.5);
echo round(1.95583, 2);
echo round(1241757, -3);
echo round(5.045, 2);
?>
Result :
5
6
1.96
1242000
5.05
In the above example the "precision" values are provided for some digits, based on which the value is rounded to the nearest integer.