note 99425 added to function.com-create-guid
| From: | AlixAxel at osu1 dot php dot net | Date: | Mon, 16 Aug 2010 22:59:39 +0000 |
| Subject: | note 99425 added to function.com-create-guid | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-171742@lists.php.net to get a copy of this message | ||
The phunction PHP framework (http://sourceforge.net/projects/phunction/) uses the following function
to generate valid version 4 UUIDs:
<?php
function GUID()
{
if (function_exists('com_create_guid') === true)
{
return trim(com_create_guid(), '{}');
}
return sprintf('%04X%04X-%04X-%04X-%04X-%04X%04X%04X', mt_rand(0, 65535), mt_rand(0,
65535), mt_rand(0, 65535), mt_rand(16384, 20479), mt_rand(32768, 49151), mt_rand(0, 65535),
mt_rand(0, 65535), mt_rand(0, 65535));
}
?>
The output generated by the sprintf() and mt_rand() calls is identical to com_create_guid() results.
----
Server IP: 194.8.30.16
Probable Submitter: 95.136.98.19
----
Manual Page -- http://www.php.net/manual/en/function.com-create-guid.php
Edit -- https://master.php.net/note/edit/99425
Del: integrated -- https://master.php.net/note/delete/99425/integrated
Del: useless -- https://master.php.net/note/delete/99425/useless
Del: bad code -- https://master.php.net/note/delete/99425/bad+code
Del: spam -- https://master.php.net/note/delete/99425/spam
Del: non-english -- https://master.php.net/note/delete/99425/non-english
Del: in docs -- https://master.php.net/note/delete/99425/in+docs
Del: other reasons-- https://master.php.net/note/delete/99425
Reject -- https://master.php.net/note/reject/99425
Search -- https://master.php.net/manage/user-notes.php