function _ctools_uuid_generate_php
Generates a UUID v4 using PHP code.
Based on code from
See also
http://php.net/uniqid#65879 , but corrected.
1 string reference to '_ctools_uuid_generate_php'
- ctools_uuid_generate in ./
ctools.module - Wrapper function to create UUIDs via ctools, falls back on UUID module if it is enabled. This code is a copy of uuid.inc from the uuid module.
File
-
includes/
uuid.inc, line 39
Code
function _ctools_uuid_generate_php() {
// The field names refer to RFC 4122 section 4.1.2.
return sprintf('%04x%04x-%04x-4%03x-%04x-%04x%04x%04x', mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 4095), bindec(substr_replace(sprintf('%016b', mt_rand(0, 65535)), '10', 0, 2)), mt_rand(0, 65535), mt_rand(0, 65535), mt_rand(0, 65535));
}