.
Divya
The PHP round() function rounds a floating number.
It Returns the rounded value of number to specified precisions.
round(number,precision,mode);
<!DOCTYPE html>
<html>
<body>
<?php
echo(round(0.75) . "<br>");
echo(round(1.20) . "<br>");
?>
</body>
</html>
1
1
<!DOCTYPE html>
<html>
<body>
<?php
echo(round(4.96754,2) . "<br>");
echo(round(7.045,2) . "<br>");
echo(round(7.055,2));
?>
</body>
</html>
4.97
7.05
7.06
<!DOCTYPE html>
<html>
<body>
<?php
echo(round(2.5,0,PHP_ROUND_HALF_UP) . "<br>");
echo(round(2.5,0,PHP_ROUND_HALF_DOWN) . "<br>");
echo(round(2.5,0,PHP_ROUND_HALF_EVEN) . "<br>");
echo(round(2.5,0,PHP_ROUND_HALF_ODD) . "<br>");
?>
</body>
</html>
3
2
3
2
.