Oihana PHP Arango

sum.php

Table of Contents

Functions

sum()  : string
Return the sum of the values in an array.

Functions

sum()

Return the sum of the values in an array.

sum(mixed $numArray) : string

This helper wraps the ArangoDB AQL function SUM(numArray) which calculates the sum of all numeric values in the given array.

Example AQL usage:

SUM([1, 2, 3, 4])             // returns 10
SUM(doc.scores)               // returns sum of all scores
SUM([5, 10, 15])              // returns 30
Parameters
$numArray : mixed

Array expression containing numeric values to sum.

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

$expr = sum('[1, 2, 3, 4]');
// Produces: 'SUM([1, 2, 3, 4])'
see
https://docs.arangodb.com/stable/aql/functions/numeric/#sum
average()

For calculating the mean.

product()

For calculating the product.

since
1.0.0
author

Marc Alcaraz

Return values
string

The formatted AQL expression.

On this page

Search results