round

(PHP 3, PHP 4 >= 4.0b1)

round -- Rounds a float

Description

double round (double val [, int precision])

Returns the rounded value of val to specified precision (number of digits after the decimal point).


$foo = round (3.4);  // $foo == 3.0
$foo = round (3.5);  // $foo == 4.0
$foo = round (3.6);  // $foo == 4.0

$foo = round (1.95583, 2);  // $foo == 1.96
      

Note: The precision parameter is only available in PHP 4.

See also ceil() and floor().