Oihana PHP Arango

zip.php

Table of Contents

Functions

zip()  : string
Build a document from an array of attribute keys and an array of values.

Functions

zip()

Build a document from an array of attribute keys and an array of values.

zip(string|array<string|int, mixed> $keys, string|array<string|int, mixed> $values) : string

Wraps the ArangoDB AQL function ZIP(keys, values). PHP arrays are emitted as JSON array literals (json_encode); strings are passed through as raw AQL expressions (e.g. doc.keys).

Example AQL usage:

ZIP(["a", "b"], [1, 2])   // returns {a: 1, b: 2}
Parameters
$keys : string|array<string|int, mixed>

The attribute keys (array literal or AQL expression).

$values : string|array<string|int, mixed>

The values, in the same order (array literal or AQL expression).

Tags
example
use function oihana\arango\db\functions\documents\zip;

$expr = zip(['a', 'b'], [1, 2]);
// Produces: 'ZIP(["a","b"],[1,2])'

$expr = zip('doc.keys', 'doc.values');
// Produces: 'ZIP(doc.keys,doc.values)'
see
https://docs.arangodb.com/stable/aql/functions/document-object/#zip
since
1.1.0
author

Marc Alcaraz

Return values
string

The formatted AQL expression.

On this page

Search results