Skip to content

Instantly share code, notes, and snippets.

@levu42
Created September 3, 2016 15:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save levu42/f650a46b0f4d6cad43a0837f96f2a81a to your computer and use it in GitHub Desktop.
Save levu42/f650a46b0f4d6cad43a0837f96f2a81a to your computer and use it in GitHub Desktop.
XKCD pwgen

Use the words.txt from this repositoty and save it in the same location as the script. Then make the script executable and run it.

#!/usr/bin/env php
<?php
$words = file(dirname(__FILE__) . '/words.txt');
for($i=0; $i<4; $i++) {
echo trim($words[array_rand($words)]);
if ($i == 3) {
echo "\n";
} else {
echo ".";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment