note 62199 deleted from function.rand by tularis
| From: | tularis@php.net | Date: | Wed, 22 Feb 2006 12:45:40 +0000 |
| Subject: | note 62199 deleted from function.rand by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-104220@lists.php.net to get a copy of this message | ||
Note Submitter:
----
Very simple code, doenst need any special function and generaters a code
<?
$alphabet = range("A","Z");
$zero = 0;
$multiplier = 5;
$length = 4;
$number = $multiplier * $length;
while($number > $zero){
$zerocut = $zero / $length;
if(substr_count($zerocut,".") == 0 AND $zero <> 0){$code = "$code-";}
$rand = rand(0,9);
$randomletter = rand(0,26);
if($rand <= 4){$code .= $alphabet[$randomletter];}else{
$code .= rand(0,9);}
++$zero;}
echo $code;
?>