note 43394 deleted from function.array-rand by nlopess

From: Date: Sat, 19 Jun 2004 17:01:40 +0000
Subject: note 43394 deleted from function.array-rand by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-71373@lists.php.net to get a copy of this message
Note Submitter: thecelestialcelebi AT hotmail DOT com ---- Why such a long function? :) Check: <?php function random_string($iLength) { $aCharacters = array_merge(range('a', 'z'), range('A', 'Z'), range(0, 9)); $iNumcharacters = count($aCharacters); $sRandomstring = ''; for($i = 0; $i < $iLength; $i++) { $sRandomstring .= $aCharacters[rand(0, $iNumcharacters)]; } return $sRandomstring; } ?> Tada!

« previous php.notes (#71373) next »