5

strrand

strrand
SYNOPSIS

strrand($charset, $len)

DESCRIPTION
CODE
  1. function strrand($charset, $len) {
  2.     $max=strlen($charset)-1;
  3.     $s = '';
  4.  
  5.     srand();
  6.  
  7.     for ($i=0; $i < $len; $i++) {
  8.         $s .= $charset[rand(0, $max)];
  9.     }
  10.  
  11.     return $s;
  12. }
SEE ALSO

newpassword

Comments

To add a comment, click here.