Posted By

jprochazka on 10/02/10


Tagged

strings


Versions (?)

Generate a random string.


 / Published in: PHP
 

This function returns a random string composed of the characters contained within the "$string" variable of the function.

  1. <?php
  2. function randomString(){
  3. $string = "abcdefghijklmnopqrstuvwxyz0123456789";
  4. for($i=0;$i<25;$i++){
  5. $pos = rand(0,36);
  6. $str .= $string[$pos];
  7. }
  8. return $str
  9. }
  10. ?>

Report this snippet  

You need to login to post a comment.