PHP find phonetic in random password script
<p>I have written this random password script which works perfectly. </p>

<p>Although I would like to add additional line below showing the phanetic alphabet for the random password.</p>

<p>How would be the best way to implement this? </p>

<pre><code> &lt;?php
function random_readable_pwd($length=10){

    // the wordlist from which the password gets generated 
    // (change them as you like)
    $words = 'AbbyMallard,AbigailGabble,AbisMal,Abu,Adella,TheAgent,AgentWendyPleakley,Akela,AltheAlligator';

    $phonetic = array("a"=&gt;"alfa","b"=&gt;"bravo","c"=&gt;"charlie","d"=&gt;"delta","e"=&gt;"echo","f"=&gt;"foxtrot","g"=&gt;"golf","h"=&gt;"hotel","i"=&gt;"india","j"=&gt;"juliett","k"=&gt;"kilo","l"=&gt;"lima","m"=&gt;"mike","n"=&gt;"november","o"=&gt;"oscar","p"=&gt;"papa","q"=&gt;"quebec","r"=&gt;"romeo","s"=&gt;"sierra","t"=&gt;"tango","u"=&gt;"uniform","v"=&gt;"victor","w"=&gt;"whisky","x"=&gt;"x-ray","y"=&gt;"yankee","z"=&gt;"zulu");

   // Split by ",":
    $words = explode(',', $words);
    if (count($words) == 0){ die('Wordlist is empty!'); }

    // Add words while password is smaller than the given length
    $pwd = '';
    while (strlen($pwd) &lt; $length){
        $r = mt_rand(0, count($words)-1);
        $pwd .= $words[$r];
    }

    $num = mt_rand(1, 99);
     if ($length &gt; 2){
        $pwd = substr($pwd,0,$length-strlen($num)).$num;
    } else { 
        $pwd = substr($pwd, 0, $length);
    }

   $pass_length = strlen($pwd);
   $random_position = rand(0,$pass_length);

   $syms = "!@#%^*()-?";
   $int = rand(0,9);
   $rand_char = $syms[$int];

   $pwd = substr_replace($pwd, $rand_char, $random_position, 0);

    return $pwd;
}
?&gt;
&lt;html&gt;&lt;head&gt;&lt;title&gt;Password generator&lt;/title&gt;&lt;/head&gt;
&lt;body&gt;&lt;p&gt;&lt;?php echo random_readable_pwd(10); ?&gt;&lt;/p&gt;&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>E.g outputs:</p>

<p><strong>Alt!heAll87</strong></p>

<p>ALFA lima tango ! hotel echo ALFA lima lima 8 7</p>
