Posted By

ghprod on 12/20/11


Tagged


Versions (?)

human-readable random string for a captcha


 / Published in: PHP
 

human-readable random string for a captcha

  1. <?php
  2.  
  3. function random($length = 8)
  4. {
  5. $chars = 'bcdfghjklmnprstvwxzaeiou';
  6.  
  7. for ($p = 0; $p < $length; $p++)
  8. {
  9. $result .= ($p%2) ? $chars[mt_rand(19, 23)] : $chars[mt_rand(0, 18)];
  10. }
  11.  
  12. return $result;
  13. }
  14.  
  15. ?>

Report this snippet  

You need to login to post a comment.