note 68237 added to function.rand
| From: | PHP-expert at osu1 dot php dot net | Date: | Wed, 19 Jul 2006 08:30:22 +0000 |
| Subject: | note 68237 added to function.rand | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-114916@lists.php.net to get a copy of this message | ||
Improofed the last function about random strings:
<?php
function randomkeys($length)
{
$pattern = "1234567890abcdefghijklmnopqrstuvwxyz";
for($i=0;$i<$length;$i++)
{
if(isset($key))
$key .= $pattern{rand(0,35)};
else
$key = $pattern{rand(0,35)};
}
return $key;
}
?>
So there isn't anymore an error (notice) about $key when FOREACH runs the first time.
----
Server IP: 212.124.37.9
Probable Submitter: 87.123.7.174
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.rand.php
Edit -- http://master.php.net/note/edit/68237
Del: integrated -- http://master.php.net/note/delete/68237/integrated
Del: useless -- http://master.php.net/note/delete/68237/useless
Del: bad code -- http://master.php.net/note/delete/68237/bad+code
Del: spam -- http://master.php.net/note/delete/68237/spam
Del: non-english -- http://master.php.net/note/delete/68237/non-english
Del: in docs -- http://master.php.net/note/delete/68237/in+docs
Del: other reasons-- http://master.php.net/note/delete/68237
Reject -- http://master.php.net/note/reject/68237
Search -- http://master.php.net/manage/user-notes.php