Oihana PHP Arango

parseKey.php

Table of Contents

Functions

parseKey()  : string|null
Returns the `_key` portion of an ArangoDB document handle (`<collection>/<key>`).

Functions

parseKey()

Returns the `_key` portion of an ArangoDB document handle (`<collection>/<key>`).

parseKey(string|null $id) : string|null

PHP mirror of the AQL function PARSE_KEY. If the input has no / separator it is returned as-is — the helper accepts both full handles ("users/abc123") and bare keys ("abc123") and always returns a usable _key string.

Parameters
$id : string|null

The full document handle (e.g. "users/abc123") or a bare _key.

Tags
example
parseKey( 'users/abc123' ) ; // 'abc123'
parseKey( 'roles/42' )     ; // '42'
parseKey( 'just-a-key' )   ; // 'just-a-key' (passes through)
parseKey( null )           ; // null
parseKey( '' )             ; // null
see
parseIdentifier()

Returns the full {collection, key} pair.

parseCollection()

Returns just the collection name.

https://docs.arango.ai/arangodb/stable/aql/functions/document-object/#parse_key
author

Marc Alcaraz

Return values
string|null

The _key portion, or null when $id is null / empty.

On this page

Search results