note 26146 added to function.srand
| From: | vinod at todays-deals dot com | Date: | Sat, 19 Oct 2002 18:57:30 +0000 |
| Subject: | note 26146 added to function.srand | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-38305@lists.php.net to get a copy of this message | ||
hi,
Here is one useful function that returns random string for given length
//#########################//
function randomstring($len)
{
srand(date("s"));
while($i<$len)
{
$str.=chr((rand()%26)+97);
$i++;
}
$str=$str.substr(uniqid (""),0,22);
return $str;
}
$rand_value=randomstring(10);
//#########################//
Thanks
Vinod
http://www.todays-deals.com
--
http://www.php.net/manual/en/function.srand.php
http://master.php.net/manage/user-notes.php?action=edit+26146
http://master.php.net/manage/user-notes.php?action=delete+26146
http://master.php.net/manage/user-notes.php?action=reject+26146