note 62199 added to function.rand

From: Date: Wed, 22 Feb 2006 09:33:51 +0000
Subject: note 62199 added to function.rand
Groups: php.notes 
Request: Send a blank email to php-notes+get-104204@lists.php.net to get a copy of this message
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; ?> ---- Server IP: 83.137.20.120 Probable Submitter: 213.84.116.241 (proxied: 1.1 ISA_COMBI) ---- Manual Page -- http://www.php.net/manual/en/function.rand.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+62199 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+62199&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+62199&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+62199&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+62199&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+62199&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+62199&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+62199&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+62199&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#104204) next »