Generate mnemonic passwords

<?php
# Generate pronounceable and thereby easier remembered,
# not-quite-so random passwords despite of their length.

$charset = array(
    # consonants (some left out for clarity or better
    # pronounciation)
    array('b', 'd', 'f', 'g', 'h', 'k', 'l', 'm',
          'n', 'p', 'r', 's', 't', 'v', 'w', 'z'),
    # vowels
    array('a', 'e', 'i', 'o', 'u'));

function gen_mnemonic_password($letters=8, $digits=2) {
    global $charset;
    $pw = array();
    foreach (range(0, $letters - 1) as $i)
        $pw[] = $charset[$i % 2][array_rand($charset[$i % 2])];
    foreach (range(1, $digits) as $i)
        $pw[] = rand(0, 9);
    return implode('', $pw);
}

# usage
echo gen_mnemonic_password();
?>