flatten.php
Table of Contents
Functions
- flatten() : string
- Turn an array of arrays into a flat array, down to a given depth.
Functions
flatten()
Turn an array of arrays into a flat array, down to a given depth.
flatten(mixed $anyArray[, int|null $depth = null ]) : string
This helper wraps the ArangoDB AQL function FLATTEN(anyArray, depth). Without a
depth, one level is flattened.
Example AQL usage:
FLATTEN([ 1 , [ 2 , 3 ] , [ 4 , [ 5 ] ] ]) // [ 1 , 2 , 3 , 4 , [ 5 ] ]
FLATTEN([ 1 , [ 2 , 3 ] , [ 4 , [ 5 ] ] ] , 2) // [ 1 , 2 , 3 , 4 , 5 ]
FLATTEN(doc.stops[*].scans) // every scan of every stop
Parameters
- $anyArray : mixed
-
The array expression to flatten.
- $depth : int|null = null
-
How many levels to flatten, one when null.
Tags
Return values
string —The formatted AQL expression.