wp_generate_uuid4() WordPress Function
The wp_generate_uuid4 function is used to generate a unique identifier for a given value. This function is useful for creating a unique identifier for an object or a user.
wp_generate_uuid4() #
Generate a random UUID (version 4).
Return
(string) UUID.
Source
File: wp-includes/functions.php
function wp_generate_uuid4() { return sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x', mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0x0fff ) | 0x4000, mt_rand( 0, 0x3fff ) | 0x8000, mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ) ); }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
4.7.0 | Introduced. |