Oihana PHP Arango

isAQLId.php

Table of Contents

Functions

isAQLId()  : bool
Checks if a value is a string matching the ArangoDB Document ID format (e.g., "collection/key").

Functions

isAQLId()

Checks if a value is a string matching the ArangoDB Document ID format (e.g., "collection/key").

isAQLId(mixed $value) : bool

This function validates the format, not whether the document actually exists. It specifically checks for a string containing exactly one '/' separator, with characters on both sides.

Parameters
$value : mixed

The value to check.

Tags
example
var_dump( isAQLId( 'users/12345'          ) ); // bool(true)
var_dump( isAQLId( 'my_collection/my-key' ) ); // bool(true)
var_dump( isAQLId( 'users'                ) ); // bool(false)
var_dump( isAQLId( 'users/'               ) ); // bool(false)
var_dump( isAQLId( '/12345'               ) ); // bool(false)
var_dump( isAQLId( 'users/123/abc'        ) ); // bool(false)
var_dump( isAQLId( '@startVertex'         ) ); // bool(false)
var_dump( isAQLId( 12345                  ) ); // bool(false)
var_dump( isAQLId( null                   ) ); // bool(false)
Return values
bool

True if the value is a string in "collection/key" format, false otherwise.

On this page

Search results