Oihana PHP Arango

round.php

Table of Contents

Functions

round()  : string
Return the integer closest to the given value.

Functions

round()

Return the integer closest to the given value.

round(string|int|float $value) : string

This helper wraps the ArangoDB AQL function ROUND(value) which rounds a number to the nearest integer using standard rounding rules.

Example AQL usage:

ROUND(4.1)                    // returns 4
ROUND(4.5)                    // returns 5
ROUND(4.9)                    // returns 5
ROUND(doc.price)              // rounds the price to nearest integer
Parameters
$value : string|int|float

Any number to round to nearest integer.

Tags
example
use function oihana\arango\db\functions\numerics\round;

$expr = round(4.5);
// Produces: 'ROUND(4.5)'
see
https://docs.arangodb.com/stable/aql/functions/numeric/#round
ceil()

For rounding up.

floor()

For rounding down.

since
1.0.0
author

Marc Alcaraz

Return values
string

The formatted AQL expression.

On this page

Search results