Created
April 25, 2012 14:59
-
-
Save jonsherrard/2490373 to your computer and use it in GitHub Desktop.
Random string generator a-la imgur urls etc.
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 generate_string($length) { | |
$chars = "0123456789abcdefghijklmnopqrstuvwxyz"; | |
$string = ""; | |
for ($i = 0; $i < $length; $i++) { | |
$string .= $chars[mt_rand(0, strlen($chars) - 1)]; | |
} | |
return $string; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment