Oihana PHP Arango

first.php

Table of Contents

Functions

first()  : string
Get the first element of an array.

Functions

first()

Get the first element of an array.

first(mixed $anyArray) : string

This helper wraps the ArangoDB AQL function FIRST(anyArray) which returns the first element of the given array. If the array is empty, it returns null.

Example AQL usage:

FIRST([1, 2, 3])            // returns 1
FIRST(doc.items)            // returns first item from doc.items
FIRST([])                   // returns null
Parameters
$anyArray : mixed

Array expression to get the first element from.

Tags
example
use function oihana\arango\db\functions\arrays\first;

$expr = first('[1,2,3]');
// Produces: 'FIRST([1,2,3])'
see
https://docs.arangodb.com/stable/aql/functions/array/#first
last()

For getting the last element.

since
1.0.0
author

Marc Alcaraz

Return values
string

The formatted AQL expression.

On this page

Search results