note 99481 deleted from function.rand by danbrown
| From: | danbrown@php.net | Date: | Thu, 19 Aug 2010 15:13:46 +0000 |
| Subject: | note 99481 deleted from function.rand by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-171852@lists.php.net to get a copy of this message | ||
Note Submitter: Random Letters and Numbers (password)
----
<?php
function RandLetterNumbers($size) {
$s = 0; // the current size
$echo = '';
$randd=
array("a","b","c","d","e","f","g","h","i","j",
"k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z",
"0","1","2","3","4","5","6","7","8","9");
while( $s < $size ) {
$randnl = $randd[rand(0,35)]; //because a=0 and 9=35
$echo = $echo . $randnl; $s++;
}
return $echo; // returns it
?>