Oihana PHP Arango

product.php

Table of Contents

Functions

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

Functions

product()

Return the product of the values in an array.

product(mixed $numArray) : string

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

Example AQL usage:

PRODUCT([1, 2, 3, 4])         // returns 24 (1×2×3×4)
PRODUCT([5, 2])               // returns 10 (5×2)
PRODUCT([10])                 // returns 10 (single value)
PRODUCT(doc.factors)          // returns product of factors array
Parameters
$numArray : mixed

Array expression containing numeric values to multiply.

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

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

For calculating the sum.

average()

For calculating the mean.

since
1.0.0
author

Marc Alcaraz

Return values
string

The formatted AQL expression.

On this page

Search results