X, is the floating-point data to be processed
Prec, save a few decimal places
Tips and comments
Note: PHP does not correctly handle strings similar to "12,300.2" by default.
Note: The Prec parameter was introduced in PHP 4.
*/
The truncated function of the instance floating-point number, and the return value is still a floating-point number.
$foo = round (3.4); $foo = 3.0
$foo = round (3.5); $foo = 4.0
$foo = round (3.6); $foo = 4.0
$foo = Round (3.6, 0); Equivalent with above
$foo = Round (1.95583, 2); $foo = 1.96
$foo = Round (1241757,-3); $foo = 1242000
Round case Two
Echo (Round (0.68));
Echo (Round (0.40));
Echo (Round (0.3));
Echo (Round (-3.30));
Echo (Round (-4.90));
/*
1
0
0
-3
-5
*/
Returns the result of rounding x according to the specified precision Prec (number of digits after the decimal point). Prec can also be negative or 0 (the default value