Posted By

level09 on 08/21/09


Tagged


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

umang_nine
ReeceMarsland


Generate Random String (ids etc ..)


 / Published in: PHP
 

  1. function generate_rand($l){
  2. $c= "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
  3. srand((double)microtime()*1000000);
  4. for($i=0; $i<$l; $i++) {
  5. $rand.= $c[rand()%strlen($c)];
  6. }
  7. return $rand;
  8. }

Report this snippet  

You need to login to post a comment.