note 35826 deleted from function.rand by aidan
| From: | aidan@php.net | Date: | Sat, 11 Sep 2004 07:42:36 +0000 |
| Subject: | note 35826 deleted from function.rand by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-76451@lists.php.net to get a copy of this message | ||
Note Submitter: bkreleger at phphulp dot nl
----
Yet another simple number generator. This will create a random number with a length of
'x'.
function NumGen($length)
{
for ($i = 1; $i <= $length; $i++)
{
if ($i == 1)
$randnum = rand(0, 9);
else
$randnum .= rand(0, 9);
}
return $randnum;
}
$password = NumGen(10);
echo $password;