Round
Table of Contents
| round() | ROUND. | float|string |
|---|---|---|
| up() | ROUNDUP. | float|string |
| down() | ROUNDDOWN. | float|string |
| multiple() | MROUND. | float|string |
| even() | EVEN. | float|string |
| odd() | ODD. | float|string |
Methods
round()
ROUND.
public
static round(
$number :
mixed
, $precision :
mixed
)
: float|string
Returns the result of builtin function round after validating args.
Parameters
- $number : mixed
Should be numeric
- $precision : mixed
Should be int
Return values
float|string —Rounded number
up()
ROUNDUP.
public
static up(
$number :
float
, $digits :
int
)
: float|string
Rounds a number up to a specified number of decimal places
Parameters
- $number : float
Number to round
- $digits : int
Number of digits to which you want to round $number
Return values
float|string —Rounded Number, or a string containing an error
down()
ROUNDDOWN.
public
static down(
$number :
float
, $digits :
int
)
: float|string
Rounds a number down to a specified number of decimal places
Parameters
- $number : float
Number to round
- $digits : int
Number of digits to which you want to round $number
Return values
float|string —Rounded Number, or a string containing an error
multiple()
MROUND.
public
static multiple(
$number :
mixed
, $multiple :
mixed
)
: float|string
Rounds a number to the nearest multiple of a specified value
Parameters
- $number : mixed
Expect float. Number to round.
- $multiple : mixed
Expect int. Multiple to which you want to round.
Return values
float|string —Rounded Number, or a string containing an error
even()
EVEN.
public
static even(
$number :
float
)
: float|string
Returns number rounded up to the nearest even integer. You can use this function for processing items that come in twos. For example, a packing crate accepts rows of one or two items. The crate is full when the number of items, rounded up to the nearest two, matches the crate's capacity.
Excel Function: EVEN(number)
Parameters
- $number : float
Number to round
Return values
float|string —Rounded Number, or a string containing an error
odd()
ODD.
public
static odd(
$number :
float
)
: float|string
Returns number rounded up to the nearest odd integer.
Parameters
- $number : float
Number to round
Return values
float|string —Rounded Number, or a string containing an error