Documentation

Round
in package
Uses ArrayEnabled

Table of Contents

Properties

$arrayArgumentHelper  : ArrayArgumentHelper|null

Methods

down()  : array<string|int, mixed>|float|string
ROUNDDOWN.
even()  : array<string|int, mixed>|float|string
EVEN.
multiple()  : array<string|int, mixed>|float|int|string
MROUND.
odd()  : array<string|int, mixed>|float|int|string
ODD.
round()  : array<string|int, mixed>|float|string
ROUND.
up()  : array<string|int, mixed>|float|string
ROUNDUP.
evaluateArrayArguments()  : array<string|int, mixed>
Handles array argument processing when the function accepts multiple arguments, and any of them can be an array argument.
evaluateArrayArgumentsIgnore()  : array<string|int, mixed>
Handles array argument processing when the function accepts multiple arguments, and any of them can be an array argument except for the one specified by ignore.
evaluateArrayArgumentsSubset()  : array<string|int, mixed>
Handles array argument processing when the function accepts multiple arguments, but only the first few (up to limit) can be an array arguments.
evaluateArrayArgumentsSubsetFrom()  : array<string|int, mixed>
Handles array argument processing when the function accepts multiple arguments, but only the last few (from start) can be an array arguments.
evaluateSingleArgumentArray()  : array<string|int, mixed>
Handles array argument processing when the function accepts a single argument that can be an array argument.
initialiseHelper()  : void
testFalse()  : bool

Properties

Methods

down()

ROUNDDOWN.

public static down(array<string|int, mixed>|float $number, array<string|int, mixed>|int $digits) : array<string|int, mixed>|float|string

Rounds a number down to a specified number of decimal places

Parameters
$number : array<string|int, mixed>|float

Number to round, or can be an array of numbers

$digits : array<string|int, mixed>|int

Number of digits to which you want to round $number, or can be an array of numbers

Return values
array<string|int, mixed>|float|string

Rounded Number, or a string containing an error If an array of numbers is passed as the argument, then the returned result will also be an array with the same dimensions

even()

EVEN.

public static even(array<string|int, mixed>|float $number) : array<string|int, mixed>|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 : array<string|int, mixed>|float

Number to round, or can be an array of numbers

Return values
array<string|int, mixed>|float|string

Rounded Number, or a string containing an error If an array of numbers is passed as the argument, then the returned result will also be an array with the same dimensions

multiple()

MROUND.

public static multiple(mixed $number, mixed $multiple) : array<string|int, mixed>|float|int|string

Rounds a number to the nearest multiple of a specified value

Parameters
$number : mixed

Expect float. Number to round, or can be an array of numbers

$multiple : mixed

Expect int. Multiple to which you want to round, or can be an array of numbers.

Return values
array<string|int, mixed>|float|int|string

Rounded Number, or a string containing an error If an array of numbers is passed as the argument, then the returned result will also be an array with the same dimensions

odd()

ODD.

public static odd(array<string|int, mixed>|float $number) : array<string|int, mixed>|float|int|string

Returns number rounded up to the nearest odd integer.

Parameters
$number : array<string|int, mixed>|float

Number to round, or can be an array of numbers

Return values
array<string|int, mixed>|float|int|string

Rounded Number, or a string containing an error If an array of numbers is passed as the argument, then the returned result will also be an array with the same dimensions

round()

ROUND.

public static round(mixed $number, mixed $precision) : array<string|int, mixed>|float|string

Returns the result of builtin function round after validating args.

Parameters
$number : mixed

Should be numeric, or can be an array of numbers

$precision : mixed

Should be int, or can be an array of numbers

Return values
array<string|int, mixed>|float|string

Rounded number If an array of numbers is passed as the argument, then the returned result will also be an array with the same dimensions

up()

ROUNDUP.

public static up(array<string|int, mixed>|float $number, array<string|int, mixed>|int $digits) : array<string|int, mixed>|float|string

Rounds a number up to a specified number of decimal places

Parameters
$number : array<string|int, mixed>|float

Number to round, or can be an array of numbers

$digits : array<string|int, mixed>|int

Number of digits to which you want to round $number, or can be an array of numbers

Return values
array<string|int, mixed>|float|string

Rounded Number, or a string containing an error If an array of numbers is passed as the argument, then the returned result will also be an array with the same dimensions

evaluateArrayArguments()

Handles array argument processing when the function accepts multiple arguments, and any of them can be an array argument.

protected static evaluateArrayArguments(callable $method, mixed ...$arguments) : array<string|int, mixed>

Example use for: ROUND() or DATE().

Parameters
$method : callable
$arguments : mixed
Return values
array<string|int, mixed>

evaluateArrayArgumentsIgnore()

Handles array argument processing when the function accepts multiple arguments, and any of them can be an array argument except for the one specified by ignore.

protected static evaluateArrayArgumentsIgnore(callable $method, int $ignore, mixed ...$arguments) : array<string|int, mixed>

Example use for: HLOOKUP() and VLOOKUP(), where argument 1 is a matrix that needs to be treated as a database rather than as an array argument.

Parameters
$method : callable
$ignore : int
$arguments : mixed
Return values
array<string|int, mixed>

evaluateArrayArgumentsSubset()

Handles array argument processing when the function accepts multiple arguments, but only the first few (up to limit) can be an array arguments.

protected static evaluateArrayArgumentsSubset(callable $method, int $limit, mixed ...$arguments) : array<string|int, mixed>

Example use for: NETWORKDAYS() or CONCATENATE(), where the last argument is a matrix (or a series of values) that need to be treated as a such rather than as an array arguments.

Parameters
$method : callable
$limit : int
$arguments : mixed
Return values
array<string|int, mixed>

evaluateArrayArgumentsSubsetFrom()

Handles array argument processing when the function accepts multiple arguments, but only the last few (from start) can be an array arguments.

protected static evaluateArrayArgumentsSubsetFrom(callable $method, int $start, mixed ...$arguments) : array<string|int, mixed>

Example use for: Z.TEST() or INDEX(), where the first argument 1 is a matrix that needs to be treated as a dataset rather than as an array argument.

Parameters
$method : callable
$start : int
$arguments : mixed
Return values
array<string|int, mixed>

evaluateSingleArgumentArray()

Handles array argument processing when the function accepts a single argument that can be an array argument.

protected static evaluateSingleArgumentArray(callable $method, array<string|int, mixed> $values) : array<string|int, mixed>

Example use for: DAYOFMONTH() or FACT().

Parameters
$method : callable
$values : array<string|int, mixed>
Return values
array<string|int, mixed>

initialiseHelper()

private static initialiseHelper(array<string|int, mixed>|false $arguments) : void
Parameters
$arguments : array<string|int, mixed>|false

Can be changed to array for Php8.1+

testFalse()

private static testFalse(mixed $value) : bool
Parameters
$value : mixed
Return values
bool

        
On this page

Search results