The PHPround () function rounds the php function. In php, the round () function is used to round the floating point number. The round (x, prec) PHP round () function is rounded to the php function. In php, the round () function is used to round the floating point number. Round (x, prec)
Script ec (2); script
X is the floating point data to be processed.
Prec, save a few decimal places
Tips and comments
Note: PHP cannot properly process strings similar to "12,300.2" by default.
Note: The prec parameter is introduced in PHP 4 ..
*/
// The Truncation function of the Instance floating point number. 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 instance 2
Echo (roround (0.68 ));
Echo (roround (0.40 ));
Echo (roround (0.3 ));
Echo (round (-3.30 ));
Echo (round (-4.90 ));
/*
1
0
0
-3
-5
*/
// Returns the result of rounding x to the specified precision prec (number of digits after decimal point. Prec can also be a negative number or zero (Default Value