Skip to content

Instantly share code, notes, and snippets.

@ivan1911
Created July 12, 2013 10:53
Show Gist options
  • Save ivan1911/5983532 to your computer and use it in GitHub Desktop.
Save ivan1911/5983532 to your computer and use it in GitHub Desktop.
Generate random password
function random_password( $length = 8 ) {
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()_-=+;:,.?";
$password = substr( str_shuffle( $chars ), 0, $length );
return $password;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment