Skip to content

Instantly share code, notes, and snippets.

@przor3n
Created September 15, 2017 08:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save przor3n/4acb4168e11220fa033a7a0822337177 to your computer and use it in GitHub Desktop.
Save przor3n/4acb4168e11220fa033a7a0822337177 to your computer and use it in GitHub Desktop.
function generate_random($string) {
$charactersLength = strlen($string);
$randomString = '';
for ($i = 0; $i < $charactersLength; $i++) {
$randomString .= $string[rand(0, $charactersLength - 1)];
}
return $randomString;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment