note 34137 added to function.rand

From: Date: Wed, 16 Jul 2003 23:13:51 +0000
Subject: note 34137 added to function.rand
Groups: php.notes 
Request: Send a blank email to php-notes+get-52233@lists.php.net to get a copy of this message
A short random string generator (80 chars long): $l = 8; for(;strlen($s)<=$l;$s.=chr(rand($a=ord('A'),ord('Z'))+ rand()%2*(ord('a')-$a))); this will define a new string variable '$s', which is filled with a string of length '$l'. It contains both uppercase and lowercase characters. ---- Manual Page -- http://www.php.net/manual/en/function.rand.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+34137 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+34137&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+34137&report=yes

« previous php.notes (#52233) next »