Random String in PHP
<p>Hello i want to generate random string in php with repetition like Ag7hlA. is there anyway to do it i am trying this</p>

<pre><code>&lt;?php
function random_string($length)
{
    $length = (int) $length;
    if ($length &lt; 1) return '';

    $base = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz123456789";
    $max = strlen($base) - 1;

    $string = '';    
    while ($len--)
    {
        $string = $base[mt_rand(0, $max)];
    }
    return $string;
}    
?&gt;
</code></pre>

<p>But the random string is not being generated</p>
