Skip to content

Instantly share code, notes, and snippets.

@sdeluce
Created January 22, 2014 10:51
Show Gist options
  • Select an option

  • Save sdeluce/8556807 to your computer and use it in GitHub Desktop.

Select an option

Save sdeluce/8556807 to your computer and use it in GitHub Desktop.
Génère une suite de caractères aléatoire
<?php
function generate_rand($l){
$c= "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
srand((double)microtime()*1000000);
for($i=0; $i<$l; $i++) {
$rand.= $c[rand()%strlen($c)];
}
return $rand;
}
echo generate_rand(10);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment