note 53328 deleted from function.rand by felipe

From: Date: Sun, 30 Dec 2007 18:43:16 +0000
Subject: note 53328 deleted from function.rand by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-134420@lists.php.net to get a copy of this message
Note Submitter: uoseth at gmail dot com ---- If you really want to the kye to have 40 chars, you must use for ($i=0;$i<=$length;$i++) and not for ($i=0;$i<$length;$i++) ... there it is with the detail added <? // RANDOM KEY PARAMETERS $keychars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; $length = 40; // RANDOM KEY GENERATOR $randkey = ""; $max=strlen($keychars)-1; for ($i=0;$i<=$length;$i++) { $randkey .= substr($keychars, rand(0, $max), 1); } ?>

« previous php.notes (#134420) next »