decodeRevision.php
Table of Contents
Functions
- decodeRevision() : array<string|int, mixed>|null
- Decompose the specified revision string into its components.
Functions
decodeRevision()
Decompose the specified revision string into its components.
decodeRevision(string|null $revision[, bool $throwable = false ]) : array<string|int, mixed>|null
The resulting object has a date and a count attribute. This function is supposed to be called with the _rev attribute value of a database document as argument.
Decodes an ArangoDB revision string (_rev) into a timestamp and a counter.
This function implements the C++ algorithm used by ArangoDB to decode the _rev string
into a 64-bit integer, then splits it into a timestamp (milliseconds since epoch) and a counter.
The result is returned as an associative array with 'date' (ISO 8601 format) and 'count' (integer).
Parameters
- $revision : string|null
-
The ArangoDB revision string (e.g., "jGPSg12---"). Must be 10 or 11 characters long, start with '', and contain at least one letter.
- $throwable : bool = false
-
If true, throws exceptions on error. If false, returns null on error.
Tags
Return values
array<string|int, mixed>|null —Returns an associative array with 'date' and 'count' keys on success, or null on failure.
Example return value: ['date' => '2025-01-20T15:28:40.830Z', 'count' => 0].
Returns null if the input is invalid or if the GMP extension is not loaded.