Skip to content

Instantly share code, notes, and snippets.

@andrit
Created July 27, 2018 14:55
Show Gist options
  • Save andrit/73768f299e6da850e6a494e373136362 to your computer and use it in GitHub Desktop.
Save andrit/73768f299e6da850e6a494e373136362 to your computer and use it in GitHub Desktop.
simple php random string generator
 public function randomString($length) {
        $key = '';
        $keys = array_merge(range(0, 9), range('a', 'z'));
    
        for ($i = 0; $i < $length; $i++) {
            $key .= $keys[array_rand($keys)];
        }
    
        return $key;
    }
    ```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment