title: Generating a unique random string of a certain length and restrictions in PHP?
body: <p>I have the need to generate a random alphanumeric string of 8 characters. So it should look sort of like <code>b53m1isM</code> for example. Both upper and lower case, letters and numbers.</p>
  
  <p>I already have a loop that runs eight times and what I want it to do is to concatenate a string with a new random character every iteration. </p>
  
  <p>Here's the loop:</p>
  
  <pre><code>$i = 0;
      while($i &lt; 8)
      {
          $randPass = $randPass + //random char
          $i = $i + 1;
      }
  </code></pre>
  
  <p>Any help?</p>