note 74325 added to function.rand
| From: | jont at live dot co dot uk | Date: | Thu, 05 Apr 2007 10:42:36 +0000 |
| Subject: | note 74325 added to function.rand | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-125109@lists.php.net to get a copy of this message | ||
isn't this just a simpler way of making a random id for somthing? I mean i know that there is a
very slight chance that a duplicate could be made but its a very, very, very small chance, nearly
impossible.
$rand = mt_rand(0, 32);
$code = md5($rand . time());
echo "$code";
and if you don't want it the md5 can be removed, I've just added it as a prefer it there
:)
Jon
----
Server IP: 194.145.210.4
Probable Submitter: 82.39.226.26
----
Manual Page -- http://www.php.net/manual/en/function.rand.php
Edit -- https://master.php.net/note/edit/74325
Del: integrated -- https://master.php.net/note/delete/74325/integrated
Del: useless -- https://master.php.net/note/delete/74325/useless
Del: bad code -- https://master.php.net/note/delete/74325/bad+code
Del: spam -- https://master.php.net/note/delete/74325/spam
Del: non-english -- https://master.php.net/note/delete/74325/non-english
Del: in docs -- https://master.php.net/note/delete/74325/in+docs
Del: other reasons-- https://master.php.net/note/delete/74325
Reject -- https://master.php.net/note/reject/74325
Search -- https://master.php.net/manage/user-notes.php