The round() function round the number up or down based on their value.
PHP round() Function Example:
The round() function round the number up or down based on their value. The number have two part first is decimal and after decimal point is fraction, if the value of fraction part is greater then .5 then round() function round up these number or if the value of fraction part less then .5 then round function round down these number.
Example:
<?php echo(round(0.80) . "<br />"); echo(round(0.51) . "<br />"); echo(round(0.45) . "<br />"); echo(round(-6.50) . "<br />"); echo(round(-6.49)); ?>
Output:
The output of this example is:
1 1 0 -7 -6
[ 0 ] Comments