Skip to content

Instantly share code, notes, and snippets.

@cuonghuynh
Created August 4, 2016 04:52
Show Gist options
  • Save cuonghuynh/43183a67126d7212566a89be8aea43bb to your computer and use it in GitHub Desktop.
Save cuonghuynh/43183a67126d7212566a89be8aea43bb to your computer and use it in GitHub Desktop.
function randomPassword($length = 6) {
$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