best random string generator


SUBMITTED BY: admaster

DATE: Nov. 4, 2015, 2:49 p.m.

FORMAT: PHP

SIZE: 327 Bytes

HITS: 18578

  1. <?php
  2. function id()
  3. {
  4. // add limit
  5. $id_length = 20;
  6. // add any character / digit
  7. $alfa = "abcdefghijklmnopqrstuvwxyz1234567890";
  8. $token = "";
  9. for($i = 1; $i < $id_length; $i ++) {
  10. // generate randomly within given character/digits
  11. @$token .= $alfa[rand(1, strlen($alfa))];
  12. }
  13. return $token;
  14. }
  15. ?>

comments powered by Disqus