round
round — Rounds a float.Description
round( int|float $num, int $precision = 0, int $mode = PHP_ROUND_HALF_UP ): floatReturns the rounded value of num to specified precision (number of digits after the decimal point). precision can also be negative or zero (default).
Parameters
num
The value to round.
characters
The optional number of decimal digits to round to.
If the precision is positive, num is rounded to precision significant digits after the decimal point.
If the precision is negative, num is rounded to precision significant digits before the decimal point, i.e. to the nearest multiple of pow(10, -precision), e.g. for a precision of -1 num is rounded to tens, for a precision of -2 to hundreds, etc.
If the precision is positive, num is rounded to precision significant digits after the decimal point.
If the precision is negative, num is rounded to precision significant digits before the decimal point, i.e. to the nearest multiple of pow(10, -precision), e.g. for a precision of -1 num is rounded to tens, for a precision of -2 to hundreds, etc.
mode
Use one of the following constants to specify the mode in which rounding occurs.
Return Values
The value rounded to the given precision as a float.More information about round on official PHP documentation site
round - Popular snippets
- PHP 8.0 / MySQL 5.7 round memory_get_usage
last run:
2023-05-23 23:22:52
111
- PHP 8.2.13 / MySQL 5.7 microtime round explode end
last run:
2024-08-30 19:40:32
35
- PHP 8.0 / MySQL 5.7 round memory_get_usage str_repeat round memory_get_usage str_repeat
last run:
2021-04-20 15:37:57
21
- PHP 7.4 / MySQL 5.7 microtime round
last run:
2022-03-10 19:44:01
19
- PHP 7.4 / MySQL 5.7 date_default_timezone_set time round
last run:
2023-03-26 15:14:11
18
- PHP 8.0 / MySQL 5.7 mt_rand mt_getrandmax round
last run:
2021-10-20 17:39:04
14
- PHP 8.1 / MySQL 5.7 var_dump round
last run:
2023-06-29 12:17:22
13
- PHP 7.4 / MySQL 5.7 preg_match str_replace date_default_timezone_set strtotime date round abs
last run:
2023-03-26 14:06:36
13
- PHP 8.2.13 / MySQL 5.7 microtime number_format explode round end
last run:
2024-08-30 19:42:48
9
round - New snippets
-
PHP 8.2.13 / MariaDB 10 serialize round intval var_dump
added at:
2024-10-03 09:52:00
2
-
PHP 8.2.13 / MariaDB 10 serialize round
added at:
2024-10-03 09:50:48
1
-
PHP 8.2.13 / MariaDB 10 serialize round
added at:
2024-10-03 09:49:55
1
-
PHP 8.2.13 / MariaDB 10 serialize round
added at:
2024-10-03 09:49:18
1
-
PHP 8.2.13 / MariaDB 10 serialize round
added at:
2024-10-03 09:49:07
1
-
PHP 8.2.13 / MySQL 5.7 microtime number_format explode round end
added at:
2024-08-30 19:42:38
9
-
PHP 8.2.13 / MySQL 5.7 microtime round explode end
added at:
2024-08-30 19:40:46
1
-
PHP 8.2.13 / MySQL 5.7 microtime round explode end
added at:
2024-08-30 19:39:32
35
-
PHP 8.2.13 / MySQL 5.7 microtime explode round end
added at:
2024-08-30 19:38:58
1
-
PHP 8.2.13 / MySQL 5.7 microtime explode round end
added at:
2024-08-30 19:37:45
3