irwan

PHP : Human Readable Random String

Mar 15th, 2012
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.58 KB | None | 0 0
  1. <?php
  2.  
  3.     /**************
  4.     *@length - length of random string (must be a multiple of 2)
  5.     **************/
  6.     function readable_random_string($length = 6){
  7.         $conso=array("b","c","d","f","g","h","j","k","l",
  8.         "m","n","p","r","s","t","v","w","x","y","z");
  9.         $vocal=array("a","e","i","o","u");
  10.         $password="";
  11.         srand ((double)microtime()*1000000);
  12.         $max = $length/2;
  13.         for($i=1; $i<=$max; $i++)
  14.         {
  15.         $password.=$conso[rand(0,19)];
  16.         $password.=$vocal[rand(0,4)];
  17.         }
  18.         return $password;
  19.     }
  20. ?>
Advertisement
Add Comment
Please, Sign In to add comment