note 11935 added to function.rand.php
| From: | krome at link dot si | Date: | Wed, 14 Mar 2001 10:19:16 +0000 |
| Subject: | note 11935 added to function.rand.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-12387@lists.php.net to get a copy of this message | ||
Hi && How are you gentleman ? :)
Same as function above but without substr function
(no need to use functions for everything):
function rand_string ($pass_len = 10)
{
$allchar = "abcdefghijklnmopqrstuvwxyzABCDEFGHIJKLNMOPQRSTUVWXYZ0123456789";
mt_srand ((double) microtime() * 1000000);
for ($i = 0, $str = "", $sz = strlen($allchar); $i < $pass_len; ++$i)
$str .= $allchar[mt_rand(0, $sz)];
return ($str);
}
http://www.php.net/manual/en/function.rand.php