PHP is a random string generation code

  • 2020-03-31 20:49:17
  • OfStack

 
 
function generate_rand($l){ 
$c= "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; 
srand((double)microtime()*1000000); 
for($i=0; $i<$l; $i++) { 
$rand.= $c[rand()%strlen($c)]; 
} 
return $rand; 
} 

Here is an excerpt from a previous post on this site. More tips are available.
(link: #)

Related articles: