Notice: Uninitialized string offset: 62 in /.../libraries/functions.php on line 316
<p>Man oh man I cannot figure this out... Please help.
What a missing here?</p>

<p>here are the errors:</p>

<pre><code>Notice: Uninitialized string offset: 62 in /..../libraries/functions.php on line 316
Notice: Undefined variable: stilldo in /..../libraries/functions.php on line 322
</code></pre>

<p>Here is the code:</p>

<pre><code>function generate_password($length = 12, $letters = true, $mixed_case = true, $numbers = true, $punctuation = false){

    ## Generate the alfa
    $alfa = '';
    if($letters == true)    $alfa .= 'abcdefghijklmnopqrstuvwxyz';
    if($mixed_case == true) $alfa .= strtoupper('abcdefghijklmnopqrstuvwxyz');
    if($numbers == true)    $alfa .= '0123456789';
    if($punctuation == true)$alfa .= '~!@#$%^&amp;*(),.=+&lt;&gt;';

    ## Set Random Seed
    if(!function_exists('_generate_password_seed')):
    function _generate_password_seed(){
        list($usec, $sec) = explode(' ', microtime());
        return (float) $sec + ((float) $usec * 100000);
    }
    endif;
    srand(_generate_password_seed());

    ## Generate the password
    $token = "";
    for($i = 0; $i &lt; $length; $i ++) {
        $token .= $alfa[@rand(0, @strlen($alfa))];
    }

    ## Check the length
    if(strlen($token) &lt; $length){
        // echo $stilldo = $length - strlen($token);
        $token .= generate_password($stilldo);
    }

    ## Return the password
    return $token;
}
</code></pre>

<p>I get this error 5 out of 10 times i run this function and I can't seem to crack it.</p>
