Round PHP Function

Round PHP Function. In this program, we can print the number with rounded value as output.  The round() method in PHP has three parameters: number, precision, and mode, the latter two of which are optional. The rounded value of the argument supplied is returned by the round() method.

<?php
echo(round(1.30) . "<br>");
echo(round(0.60) . "<br>");
?>

 

Output:

1

1

Float Datatype in Php

A float is a data type in computer science that is formed of a number that is not an integer since it includes a fraction written in decimal notation. Some argue that the float data type is employed in computer programming when more accuracy than integers can give is required.

Round() Function in Php

In PHP, the round() function is used to round a floating-point value. It may be used to provide a precision value and then round numbers based on that precision value. Precision may also be negative or zero. The round() method in PHP takes three parameters: number, precision, and mode, the latter two of which are optional. The round() method returns the argument’s rounded value.