PHP round() function with example
In this article, We will explain to you PHP round() function with example.
PHP round() function
The round() function is a built-in function of PHP. which is used to returns the rounds a number to the nearest integer. so you can see our PHP math Function example.
Syntax
round(number,precision,mode);
Example
<?PHP
echo round(5.8);
echo "
";
echo round(-5.1);
echo "
";
echo round(-5.9);
echo "
";
echo round(0.49);
echo "
";
echo round(0.50);
?>
Output
6
-5
-6
0
1
Reference: PHP round() function