Skip to content

Instantly share code, notes, and snippets.

@Siedrix
Created May 3, 2010 08:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Siedrix/387862 to your computer and use it in GitHub Desktop.
Save Siedrix/387862 to your computer and use it in GitHub Desktop.
function randString(){
$n = 20;
$characters = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
$string = "";
$l = strlen($characters);
for ($i = 0; $i < $n; $i++) {
$string .= $characters[rand(0, $l)];
}
return $string;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment