note 51943 deleted from function.rand by felipe
| From: | felipe@php.net | Date: | Sun, 30 Dec 2007 18:42:50 +0000 |
| Subject: | note 51943 deleted from function.rand by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-134413@lists.php.net to get a copy of this message | ||
Note Submitter: goochivasquez -at- gmail
----
Following script generates a random key of characters and numbers. Handy for random logins or
verifications.
***
// RANDOM KEY PARAMETERS
$keychars = "abcdefghijklmnopqrstuvwxyz0123456789";
$length = 40;
// RANDOM KEY GENERATOR
$randkey = "";
for ($i=0;$i<$length;$i++)
$randkey .= substr($keychars, rand(1, strlen($keychars) ), 1);