Skip to content

Instantly share code, notes, and snippets.

@AndrewChamp
Created September 29, 2015 02:57
Show Gist options
  • Save AndrewChamp/7c1c6c53db5bb4df4687 to your computer and use it in GitHub Desktop.
Save AndrewChamp/7c1c6c53db5bb4df4687 to your computer and use it in GitHub Desktop.
Random Keygen
<?php
function keygen($length='40'){
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
$size = strlen($chars);
for($i = 0; $i < $length; $i++):
$str .= $chars[ rand( 0, $size - 1 ) ];
endfor;
return $str;
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment