note 40587 added to function.array-rand

From: Date: Tue, 09 Mar 2004 00:36:08 +0000
Subject: note 40587 added to function.array-rand
Groups: php.notes 
Request: Send a blank email to php-notes+get-66459@lists.php.net to get a copy of this message
Another array based password generator, this one is a port from the python mailman version. this generates slightly predictable but human readable passwords that people can remember output passwords are for example "rikanumi" // port of mailman version function MakeRandomPassword($length=6) { $_vowels = array ('a', 'e', 'i', 'o', 'u'); $_consonants = array ('b', 'c', 'd', 'f', 'g', 'h', 'k', 'm', 'n','p', 'r', 's', 't', 'v', 'w', 'x', 'z'); $_syllables = array (); foreach ($_vowels as $v) { foreach ($_consonants as $c) { array_push($_syllables,"$c$v"); array_push($_syllables,"$v$c"); } } for ( $i=0;$i<=($length/2);$i++) $newpass=$newpass.$_syllables[array_rand($_syllables) ]; return $newpass; } ---- Manual Page -- http://www.php.net/manual/en/function.array-rand.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+40587 Delete -- http://master.php.net/manage/user-notes.php?action=delete+40587&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+40587&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#66459) next »