Javatpoint Logo
Javatpoint Logo

Round() function :

The round() function is used to find rounds a float number. It has three parameters and returns the round value.

Syntax:

Parameter Description Optional/Required
number Specify the value to round Required
Precision Specify the number of decimal digits to round to. Optional
Mode Specify the mode in which rounding occurs.
  • PHP_ROUND_HALF_UP
  • PHP_ROUND_HALF_DOWN
  • PHP_ROUND_HALF_EVEN
  • PHP_ROUND_HALF_ODD
Optional

Example1

Output:

Befor using round() function : 3.96754,2
After using round() function : 3.97

Example2

Output:

Befor using round() function : 7.045,2
After using round() function : 7.05

Example3

Output:

Befor using round() function : 7.055,2
After using round() function : 7.06

Example4

Output:

2
-2
1
-1
2
-2
1
-1

Next TopicPHP Math





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA