Oihana PHP Arango

aqlAsc.php

Table of Contents

Functions

aqlAsc()  : string
Builds an ascending AQL `SORT` expression for the given attribute key.

Functions

aqlAsc()

Builds an ascending AQL `SORT` expression for the given attribute key.

aqlAsc(string $key[, string|null $prefix = null ]) : string

This helper simplifies the creation of SORT clauses by combining the provided key (and optional prefix) with the ASC order keyword.

The resulting string can be directly injected into an AQL statement or composed with other expressions (e.g., using aqlSort()).

Example: basic usage

echo aqlAsc('age');
// → "age ASC"

Example: with prefix

echo aqlAsc('name', 'u');
// → "u.name ASC"

Example: combined in a SORT clause

echo 'SORT ' . aqlAsc('score', 'player');
// → "SORT player.score ASC"
Parameters
$key : string

The attribute name to sort by (e.g., 'age', 'createdAt', 'score').

$prefix : string|null = null

Optional variable or collection prefix (e.g., 'u' for "u.age").

Tags
see
aqlDesc()

For descending order.

https://docs.arangodb.com/stable/aql/fundamentals/sorting
since
1.0.0
author

Marc Alcaraz

Return values
string

The formatted ascending sort expression, e.g. "doc.name ASC".

On this page

Search results