note 68217 added to function.ord
| From: | dot) | Date: | Tue, 18 Jul 2006 17:51:31 +0000 |
| Subject: | note 68217 added to function.ord | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-114893@lists.php.net to get a copy of this message | ||
You can use the following function to generate a random string between the lengths of $x and $y...
$x = 1; //minimum length
$y = 10; //maximum length
$len = rand($x,$y); //get a random string length
for ($i = 0; $i < $len; $i++) { //loop $len no. of times
$whichChar = rand(1,3); //choose if its a caps, lcase or num
if ($whichChar == 1) { //it's a number
$string .= chr(rand(48,57)); //randomly generate a num
}
elseif ($whichChar == 2) { //it's a small letter
$string .= chr(rand(65,90)); //randomly generate an lcase
}
else { //it's a capital letter
$string .= chr(rand(97,122)); //randomly generate a ucase
}
}
echo $string; //echo out the generated string
----
Server IP: 83.138.144.80
Probable Submitter: 212.159.68.209
----
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.ord.php
Edit -- http://master.php.net/note/edit/68217
Del: integrated -- http://master.php.net/note/delete/68217/integrated
Del: useless -- http://master.php.net/note/delete/68217/useless
Del: bad code -- http://master.php.net/note/delete/68217/bad+code
Del: spam -- http://master.php.net/note/delete/68217/spam
Del: non-english -- http://master.php.net/note/delete/68217/non-english
Del: in docs -- http://master.php.net/note/delete/68217/in+docs
Del: other reasons-- http://master.php.net/note/delete/68217
Reject -- http://master.php.net/note/reject/68217
Search -- http://master.php.net/manage/user-notes.php