How to create random human readable passwords in PHP

To generate random readable passwords you can combine words, letters and special chars. The words can come from a wordlist array. For example you can use the list of the 10,000 most common English words in order of frequency, as determined by n-gram frequency analysis of the Google’s Trillion Word Corpus.

In the exmaple the words are taken from a static array, but you can use the google-10000-english.txt file with the php file() function which reads an entire file into an array. The generated password will contain one or more of the words in the list, depending on the length parameter. If you execute

you will get a random readable password with a length of 10 chars, but you can adjust the parameter to get a password with a different length.