uuid_v4(): string Generates a random RFC 4122 / RFC 9562 version 4 UUID.
uuid_v7(): string Generates a time-ordered RFC 9562 version 7 UUID using the current Unix timestamp in milliseconds.
uuid_v7_from_ms(int $timestamp_ms): string Generates a time-ordered RFC 9562 version 7 UUID for a specific 48-bit Unix timestamp in milliseconds (0 to 281474976710655).
uuid_ulid(): string Generates a 26-character Crockford Base32 ULID (10-char timestamp + 16-char randomness) using the current time.
uuid_ulid_from_ms(int $timestamp_ms): string Generates a 26-character Crockford Base32 ULID for a specific 48-bit Unix timestamp in milliseconds.
uuid_is_valid(string $uuid): bool Returns true if $uuid is a valid canonical 36-character hyphenated UUID (8-4-4-4-12 hex digits, case-insensitive).
uuid_version(string $uuid): int Returns the UUID version nibble (0–15, e.g., 4 for v4, 7 for v7, 0 for NIL). Accepts any format supported by uuid_normalize.
uuid_variant(string $uuid): string Returns the UUID variant: "NIL", "NCS", "RFC4122", "Microsoft", or "Future".
uuid_timestamp_ms(string $uuid): int Extracts the 48-bit Unix millisecond timestamp from a UUID v7.
uuid_equals(string $a, string $b): bool Compares two UUIDs after normalization (case-insensitive, format-agnostic).
uuid_is_nil(string $uuid): bool Returns true if the normalized UUID equals uuid_nil().
Normalization & Formatting
uuid_normalize(string $uuid, bool $uppercase = false): string Normalizes a UUID string into canonical 36-character hyphenated format. Accepts: