note 69409 added to function.chr
| From: | jdavid at skynet dot be | Date: | Tue, 05 Sep 2006 11:33:39 +0000 |
| Subject: | note 69409 added to function.chr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-116694@lists.php.net to get a copy of this message | ||
To elaborate on JasonLauDotBiz's piece of code and also schafer at robandger dot com:
for ($i = 0; $i < 10; $i++) {
$randnum = mt_rand(0,61);
if ($randnum < 10)
$randstr .= $randnum;
else if ($randnum < 36)
$randstr .= chr($randnum+55);
else
$randstr .= chr($randnum+61);
}
echo $randstr;
This will give you a 10 character string consisting of [A-Za-z0-9]. Usefull for passwords or other
random strings.
----
Server IP: 82.146.33.222
Probable Submitter: 134.54.0.9
----
Manual Page -- http://www.php.net/manual/en/function.chr.php
Edit -- https://master.php.net/note/edit/69409
Del: integrated -- https://master.php.net/note/delete/69409/integrated
Del: useless -- https://master.php.net/note/delete/69409/useless
Del: bad code -- https://master.php.net/note/delete/69409/bad+code
Del: spam -- https://master.php.net/note/delete/69409/spam
Del: non-english -- https://master.php.net/note/delete/69409/non-english
Del: in docs -- https://master.php.net/note/delete/69409/in+docs
Del: other reasons-- https://master.php.net/note/delete/69409
Reject -- https://master.php.net/note/reject/69409
Search -- https://master.php.net/manage/user-notes.php