Last active
August 29, 2015 14:06
-
-
Save kosinix/86ad6790cc2ef42545c7 to your computer and use it in GitHub Desktop.
Generate Password 12 characters long with some characters removed (l,1,0,o) for readability
This file contains 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
<?php | |
function generateRandomString($length = 12) { | |
$characters = '23456789abcdefghijkmnpqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ !@#$%^&*()_-'; | |
$randomString = ''; | |
for ($i = 0; $i < $length; $i++) { | |
$randomString .= $characters[rand(0, strlen($characters) - 1)]; | |
} | |
return $randomString; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment