UUID::generate
Generate a new UUID
Synopsis
public static function string UUID::generate(int [in,optional] $kind = self, string [in,optional] $namespace = null, string [in,optional] $name = null)
Description
UUID::generate() generates a new UUID according to RFC 4122 (equivalent to
ITU-T Rec. X.667, ISO/IEC 9834-8:2005).
If the kind of UUID specified by $kind cannot be generated
because it is not supported, a random (v4) UUID will be generated instead (in other
words, the $kind parameter is a hint).
If the kind of UUID specified by $kind cannot be generated
because one or both of $namespace and $name
are not valid, an error occurs and null is returned.
Parameters
| Name | Direction | Type | Description |
|---|---|---|---|
$kind
| in,optional | int | The kind of UUID to generate. |
$namespace
| in,optional | string |
For MD5 (v3) and SHA1 (v5) UUIDs, the namespace which contains $name.
|
$name
| in,optional | string | For MD5 (v3) and SHA1 (v5) UUIDs, the identifier used to generate the UUID. |
Return Value
A new UUID, or null if an error occurs.