Re: Regular Expression Help: genreate alphanumeric, 8 chars
| From: | David T-G | Date: | Thu, 27 Nov 2003 13:10:37 +0000 |
| Subject: | Re: Regular Expression Help: genreate alphanumeric, 8 chars | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-171201@lists.php.net to get a copy of this message | ||
Bogdan --
..and then Bogdan Stancescu said...
%
% ...as in...
%
% <?
% // Could've been done with ASCII sets, but this way
% // you can easily tweak the eligible characters.
% $eligible='abcdefghijklmnopqrstuvwxyz0123456789';
% $pwdLen=8;
% $password='';
% for($i=0;$i<$pwdLen;$i++) {
% $password.=$eligible[rand(0,strlen($eligible))];
% }
% echo("Your new password: $password\n");
% ?>
Looks good to me. You're too kind; I was going to leave the exercise to
the student to complete :-)
%
% Bogdan
HTH & HAND
:-D
--
David T-G * There is too much animal courage in
(play) davidtg@justpickone.org * society and not sufficient moral courage.
(work) davidtgwork@justpickone.org -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/ Shpx gur
Pbzzhavpngvbaf Qrprapl Npg!