average.php
Table of Contents
Functions
- average() : string
- Return the average (arithmetic mean) of the values in an array.
Functions
average()
Return the average (arithmetic mean) of the values in an array.
average(mixed $anyArray) : string
This helper wraps the ArangoDB AQL function AVERAGE(numArray) which calculates
the arithmetic mean of all numeric values in the given array.
Example AQL usage:
AVERAGE([5, 2, 9, 2]) // returns 4.5
AVERAGE(doc.scores) // returns average of scores array
AVERAGE([1, 2, 3, 4, 5]) // returns 3.0
Parameters
- $anyArray : mixed
-
Array expression containing numeric values.
Tags
Return values
string —The formatted AQL expression.