PHP Notice: Undefined variable: str in : <p>My code</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 ) ]; // this line error 
 }
return $str;
}
</code></pre>

<p>Error</p>

<blockquote>
  <p>PHP Notice:  Undefined variable: str in ... on line 5 </p>
</blockquote>
