note 105196 deleted from function.str-shuffle by thiago

From: Date: Tue, 02 Aug 2011 14:39:41 +0000
Subject: note 105196 deleted from function.str-shuffle by thiago
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-182105@lists.php.net to get a copy of this message
Note Submitter: Anonymous ---- If using str_shuffle to get random passwords, use str_repeat to allow a character to appear multiple times: <?php substr(str_shuffle(str_repeat('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789',5)),0,5); ?> This will take the all-character string, multiply it 5 times, shuffle it, and return the first 5 characters of the shuffle.

« previous php.notes (#182105) next »