Re: Can someone help me with an array problem?

From: Date: Mon, 05 Jun 2000 03:18:11 +0000
Subject: Re: Can someone help me with an array problem?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-1012@lists.php.net to get a copy of this message
Here is a general random password generator I wrote. This might help you. function RandomPassword($length = "") { if( empty($length) ) $length = 8; $password = ""; $possiblecharacter = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz234567890_"; // removed 1(one) l(letter) to avoid confusion for($index = 0; $index < $length; $index++) { srand((double)microtime()*1000000); $number = rand(0, strlen($possiblecharacter) -1); $password = $password . $possiblecharacter[$number]; } return $password; } ----- Original Message ----- From: Alex Behrens <bigal@3d-unlimited.com> To: <php-general@lists.php.net> Sent: Sunday, June 04, 2000 7:25 PM Subject: [PHP-GENERAL] Can someone help me with an array problem? Hi, I'm rather new to PHP and I'm working on a very small script that just outputs a 9 value random alphanumeric password to my browser. What I have for the script now is listed every letter and number (62 in all) and then did 9 random commands and had it output via HTML. I would much rather create a single array and then do a rand command and loop. Can someone help me through this. I already have the array: <?php $alpha = array ( "letters" => array(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I, J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z), "numbers" => array(1,2,3,4,5,6,7,8,9,0) ); Thanks! -------------------------------------------- -Alex "Big Al" Behrens E-mail: bigal@3d-unlimited.com Phone: 651-482-8779 Fax: 651-482-1391 ICQ: 3969599 Owner of the 3D-Unlimited Network: http://www.3d-unlimited.com Send News: news@3d-unlimited.com

« previous php.general (#1012) next »