Last active
August 29, 2015 14:24
-
-
Save renatorib/982b4f4c886aa23d8f87 to your computer and use it in GitHub Desktop.
Function to Generate Token by length
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function generateToken($length = 20, $chars = 'abcdefghijklmnopqrstuvxwyzABCDEFGHIJKLMNOPQRSTUVXWYZ1234567890'){ | |
$return = ''; | |
while($length > 0){ | |
$return .= $tokens[rand(0, strlen($chars)-1)]; | |
$length--; | |
} | |
return $return; | |
} |
Author
renatorib
commented
Jul 10, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment