Posted By

Mithun on 08/19/09


Tagged

php password random String


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

Mithun
jeffery2k2610
nreliu
umang_nine


Human Readable Random String


 / Published in: PHP
 

This code will create a human readable string that will look more close to dictionary words, useful for captchas.

  1. function readable_random_string($length = 6){
  2. $conso=array("b","c","d","f","g","h","j","k","l",
  3. "m","n","p","r","s","t","v","w","x","y","z");
  4. $vocal=array("a","e","i","o","u");
  5. $password="";
  6. srand ((double)microtime()*1000000);
  7. $max = $length/2;
  8. for($i=1; $i<=$max; $i++)
  9. {
  10. $password.=$conso[rand(0,19)];
  11. $password.=$vocal[rand(0,4)];
  12. }
  13. return $password;
  14. }

Report this snippet  

You need to login to post a comment.