Posted By


Mithun on 08/19/09

Tagged


Statistics


Viewed 983 times
Favorited by 3 user(s)

Human Readable Random String


/ Published in: PHP
Save to your folder(s)

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


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.