note 79528 deleted from function.microtime by felipe
| From: | felipe@php.net | Date: | Sat, 15 Dec 2007 16:05:22 +0000 |
| Subject: | note 79528 deleted from function.microtime by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-133596@lists.php.net to get a copy of this message | ||
Note Submitter: egingell at sisna dot com
----
> lloeki
> 26-Nov-2007 02:45
> You want some unique alphanum identifier? no need for some weird loop of sort.
>
> <?php
> $id = md5(microtime());
> ?>
microtime() does not return a unique value, the chances of two people getting the same result from
said function may be astronomical, but it is still possible. This is a much better alternative:
<?
$id = md5(uniqid('')); // Passing an empty string to uniqid() makes PHP < 5 happy.
?>