How to create unique id php?
❮ PHP Misc Reference Show Definition and UsageThe uniqid() function generates a unique ID based on the microtime (the current time in microseconds). Note: The generated ID from this function does not guarantee uniqueness of the return value! To generate an extremely difficult to predict ID, use the md5() function. Syntaxuniqid(prefix,more_entropy) Parameter Values
Technical Details
❮ PHP Misc Reference (PHP 4, PHP 5, PHP 7, PHP 8) uniqid — Generate a unique ID Descriptionuniqid(string Warning This function does not
guarantee uniqueness of return value. Since most systems adjust system clock by NTP or like, system time is changed constantly. Therefore, it is possible that this function does not return unique ID for the process/thread. Use Parametersprefix Can be useful, for instance, if you generate identifiers simultaneously on several hosts that might happen to generate the identifier at the same microsecond. With an empty more_entropy If set to Return ValuesReturns timestamp based unique identifier as a string. Warning This function tries to create unique identifier, but it does not guarantee 100% uniqueness of return value. ExamplesExample #1 uniqid() Example
Notes
keith at keithtyler dot com ¶ 12 years ago
Andrew Moore ¶ 12 years ago
sprintf('%08s-%04s-%04x-%04x-%12s',// 32 bits for "time_low" hackan at gmail dot com ¶ 5 years ago
John Haugeland from FullOf.BS ¶ 13 years ago
rommel at rommelsantor dot com ¶ 11 years ago
strlen($i_url)) nodkz at mail dot ru ¶ 14 years ago
=uuid(); // 0001-7f000001-478c8000-4801-47242987 DimeCadmium ¶ 3 years ago
redtraider at gmail dot com ¶ 10 years ago
Enrico Pallazzo ¶ 12 years ago
$n=0; $n < strlen($index); $n++) { Anonymous ¶ 11 years ago
wooshoofoo ¶ 15 years ago
php at dot dot dot metehanarslan dot com ¶ 6 years ago
struuid(false); //Return sample: F4518NTQTQ mailrinke at _cutthis_yahoo dot com ¶ 15 years ago
ken at smallboxsoftware ¶ 15 years ago
david at ramaboo dot com ¶ 13 years ago
sprintf('%08s-%04s-%04x-%04x-%012s', php at ryanmckeel dot com ¶ 12 years ago
ciantic at NOSPAM dot oksidi dot com ¶ 8 years ago
uniqid_base36() . "\n"; // eb98xzzhq7 mt at banita dot de ¶ 1 year ago
sean at seancolombo dot com ¶ 13 years ago
sprintf('%08s-%04s-%04x-%04x-%012s', tom ¶ 11 years ago
jensenv at cshs dot org ¶ 7 years ago
Anonymous ¶ 9 years ago
lance_rushing at hotmail dot com ¶ 15 years ago
mark at whytewaters dot com ¶ 14 years ago
Jason ¶ 15 years ago
How can you generate a unique ID in PHP?The uniqid() function generates a unique ID based on the microtime (the current time in microseconds). Note: The generated ID from this function does not guarantee uniqueness of the return value! To generate an extremely difficult to predict ID, use the md5() function.
How do I make a global unique identifier?Users do not need to rely on a centralized authority to administer GUIDs, as anyone can use a generation algorithm to create a GUID. Individuals and organizations can create GUIDs using a free GUID generator that is available online. An online generator constructs a unique GUID according to RFC 4122.
Which of the following PHP functions can be used for generating unique ids?Which of the following PHP functions can be used for generating unique ids? Explanation: The function uniqueid() is used to generate a unique ID based on the microtime (current time in microseconds).
|