|
3 | 3 |
|
4 | 4 | # uuid-php |
5 | 5 |
|
6 | | -A small PHP class for generating [RFC 4122][RFC 4122] version 3, 4, and 5 universally unique identifiers (UUID). Additionally supports [draft][draft 03] versions 6 and 7. |
| 6 | +A small PHP class for generating [RFC 4122][RFC 4122] version 3, 4, and 5 universally unique identifiers (UUID). Additionally supports [draft][draft 04] versions 6 and 7. |
7 | 7 |
|
8 | 8 | If all you want is a unique ID, you should call `uuid4()`. |
9 | 9 |
|
@@ -60,7 +60,7 @@ var_dump($uuid6_first < $uuid6_second); // bool(true) |
60 | 60 |
|
61 | 61 | // Generate a version 7 (lexicographically sortable) UUID |
62 | 62 | $uuid7_first = UUID::uuid7(); |
63 | | -echo $uuid7_first . "\n"; // e.g. 017f21cf-d130-7cc3-98c4-dc0c0c07398f |
| 63 | +echo $uuid7_first . "\n"; // e.g. 017f22e2-79b0-7cc3-98c4-dc0c0c07398f |
64 | 64 | $uuid7_second = UUID::uuid7(); |
65 | 65 | var_dump($uuid7_first < $uuid7_second); // bool(true) |
66 | 66 |
|
@@ -114,8 +114,8 @@ var_dump($cmp3 === 0); // bool(true) |
114 | 114 | // Extract Unix time from versions 6 and 7 as a string. |
115 | 115 | $uuid6_time = UUID::getTime('1ec9414c-232a-6b00-b3c8-9e6bdeced846'); |
116 | 116 | var_dump($uuid6_time); // string(18) "1645557742.0000000" |
117 | | -$uuid7_time = UUID::getTime('017f21cf-d130-7cc3-98c4-dc0c0c07398f'); |
118 | | -var_dump($uuid7_time); // string(18) "1645539742.0001995" |
| 117 | +$uuid7_time = UUID::getTime('017f22e2-79b0-7cc3-98c4-dc0c0c07398f'); |
| 118 | +var_dump($uuid7_time); // string(18) "1645557742.0007977" |
119 | 119 |
|
120 | 120 | // Extract the UUID version. |
121 | 121 | $uuid_version = UUID::getVersion('2140a926-4a47-465c-b622-4571ad9bb378'); |
@@ -148,5 +148,5 @@ var_dump($uuid_version); // int(4) |
148 | 148 | 14 bits dedicated to sub-second precision provide 100 nanosecond resolution. The `unix_ts` and `subsec` fields guarantee the order of UUIDs generated within the same timestamp by monotonically incrementing the timer. |
149 | 149 |
|
150 | 150 | [RFC 4122]: http://tools.ietf.org/html/rfc4122 |
151 | | -[draft 03]: https://datatracker.ietf.org/doc/html/draft-peabody-dispatch-new-uuid-format-03 |
| 151 | +[draft 04]: https://datatracker.ietf.org/doc/html/draft-peabody-dispatch-new-uuid-format-04 |
152 | 152 | [stackoverflow uuid4]: https://stackoverflow.com/a/15875555 |
0 commit comments