Php undefine variable issue
<p>Following is the function which provide random string... but i'm getting this error message
<strong>Notice: Undefined variable: str in C:\xampp\htdocs\webrootfinal\forgotpasspr.php on line 5.........</strong> </p>

<pre><code>function rand_string( $length ) {
$chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";  
$size = strlen( $chars );
for( $i = 0; $i &lt; $length; $i++ ) {
$str.= $chars[ rand( 0, $size - 1 ) ];
}
return $str;                        
}
$my_string = rand_string( 10 );
</code></pre>

<p>Any Idea or Solution...</p>
