note 101657 added to function.uniqid
| From: | gearond at sbcglobal dot net | Date: | Mon, 03 Jan 2011 03:14:43 +0000 |
| Subject: | note 101657 added to function.uniqid | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-175402@lists.php.net to get a copy of this message | ||
This makes a COMB UUID, for the purpose of UUIDs as PRIMARY keys in databases.
/* requires installation of ubuntu 'php5_uuid' module
* see this URL: http://www.informit.com/articles/printerfriendly.aspx?p=25862
* else, use a search engine and look up "comb uuid", or "sequential uuid"
*
* returns a guid with the last 12 chars representing the HEX value of time
* allow better clustering of database index pages and faster performance
* while still using UUIDs
*
*/
function make_comb_uuid(){
uuid_create(&$v4);
uuid_make($v4, UUID_MAKE_V4);
uuid_export($v4, UUID_FMT_STR, &$v4String);
$var=gettimeofday();
return substr($v4String,0,24).substr(dechex($var['sec'].$var['usec']),0,12);
----
Server IP: 208.69.120.55
Probable Submitter: 75.25.120.243
----
Manual Page -- http://www.php.net/manual/en/function.uniqid.php
Edit -- https://master.php.net/note/edit/101657
Del: integrated -- https://master.php.net/note/delete/101657/integrated
Del: useless -- https://master.php.net/note/delete/101657/useless
Del: bad code -- https://master.php.net/note/delete/101657/bad+code
Del: spam -- https://master.php.net/note/delete/101657/spam
Del: non-english -- https://master.php.net/note/delete/101657/non-english
Del: in docs -- https://master.php.net/note/delete/101657/in+docs
Del: other reasons-- https://master.php.net/note/delete/101657
Reject -- https://master.php.net/note/reject/101657
Search -- https://master.php.net/manage/user-notes.php