push.php
Table of Contents
Functions
- push() : string
- Append a value to the end of an array.
Functions
push()
Append a value to the end of an array.
push(mixed $anyArray, mixed $value[, bool $unique = false ]) : string
This helper wraps the ArangoDB AQL function PUSH(anyArray, value, unique) which
adds a value to the end of an array. If unique is true, the value is only added
if it's not already present in the array.
Example AQL usage:
PUSH([2, 4, 6], 8) // returns [2, 4, 6, 8]
PUSH([2, 4, 6], 4) // returns [2, 4, 6, 4]
PUSH([2, 4, 6], 4, true) // returns [2, 4, 6] (4 already exists)
PUSH([2, 4, 6], 8, true) // returns [2, 4, 6, 8] (8 is new)
Parameters
- $anyArray : mixed
-
Array expression to append value to.
- $value : mixed
-
Value to append to the array.
- $unique : bool = false
-
When true, value is added only if not already present.
Tags
Return values
string —The formatted AQL expression.