Oihana PHP Arango

sorted.php

Table of Contents

Functions

sorted()  : string
Sort the elements of an array.

Functions

sorted()

Sort the elements of an array.

sorted(mixed $anyArray) : string

This helper wraps the ArangoDB AQL function SORTED(anyArray) which returns a new array with all elements sorted in ascending order. The original array is not modified. Elements are sorted using ArangoDB's default comparison rules.

Example AQL usage:

SORTED([4, 1, 8, 2, 3])            // returns [1, 2, 3, 4, 8]
SORTED(["c", "a", "b"])            // returns ["a", "b", "c"]
SORTED(doc.numbers)                // sorts the numbers array
Parameters
$anyArray : mixed

Array expression to sort.

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

$expr = sorted('[4,1,8,2,3]');
// Produces: 'SORTED([4,1,8,2,3])'
see
https://docs.arangodb.com/stable/aql/functions/array/#sorted
sortedUnique()

For sorting and removing duplicates.

since
1.0.0
author

Marc Alcaraz

Return values
string

The formatted AQL expression.

On this page

Search results