note 58554 deleted from function.mt-rand by googleguy

From: Date: Tue, 22 Oct 2013 14:54:33 +0000
Subject: note 58554 deleted from function.mt-rand by googleguy
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-197223@lists.php.net to get a copy of this message
Note Submitter: ripat at lumadis dot be ---- Yet another snippet to generate a password. <?php $acceptedChars = 'azertyuiopqsdfghjklmwxcvbnAZERTYUIOPQSDFGHJKLMWXCVBN0123456789'; $max = strlen($acceptedChars)-1; $password = null; for($i=0; $i < 8; $i++) { $password .= $acceptedChars{mt_rand(0, $max)}; } echo $password; ?> I have tried several ways of doing it but this simple one seems to be the fastest.

« previous php.notes (#197223) next »