note 43394 added to function.array-rand

From: Date: Sat, 19 Jun 2004 16:57:45 +0000
Subject: note 43394 added to function.array-rand
Groups: php.notes 
Request: Send a blank email to php-notes+get-71370@lists.php.net to get a copy of this message
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! ---- Manual Page -- http://www.php.net/manual/en/function.array-rand.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+43394 Delete -- http://master.php.net/manage/user-notes.php?action=delete+43394&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+43394&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#71370) next »