title: One-line PHP random string generator?
body: <p>I am looking for the shortest way to generate random/unique strings and for that I was using the following two:</p>
  <pre><code>$cClass = sha1(time());
  </code></pre>
  <p>or</p>
  <pre><code>$cClass = md5(time());
  </code></pre>
  <p>However, I need the string to begin with a letter, I was looking at base64 encoding but that adds <code>==</code> at the end and then I would need to get rid of that.</p>
  <p>What would be the best way to achieve this with one line of code?</p>
  <hr />
  <p><strong>Update:</strong></p>
  <p>PRNDL came up with a good suggestions which I ended up using it but a bit modified</p>
  <pre><code>echo substr(str_shuffle(abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ),0, 1) . substr(str_shuffle(aBcEeFgHiJkLmNoPqRstUvWxYz0123456789),0, 31)
  </code></pre>
  <p>Would yield 32 characters mimicking the md5 hash but it would always product the first char an alphabet letter, like so;</p>
  <p><img src="https://i.stack.imgur.com/zpnkU.gif" alt="solution 1" /></p>
  <p>However, <strong>Uours</strong> really improved upon and his answer;</p>
  <pre><code>substr(str_shuffle(&quot;abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ&quot;), 0, 1).substr(md5(time()),1);
  </code></pre>
  <p>is shorter and sweeter</p>
  <p>The other suggestion by <strong>Anonymous2011</strong> was very awesome but the first character for some reason would always either M, N, Y, Z so didn't fit my purposes but would have been the chosen answer, by the way does anyone know why it would always yield those particular letters?</p>
  <p>Here is the preview of my modified version</p>
  <pre><code>echo  rtrim(base64_encode(md5(microtime())),&quot;=&quot;);
  </code></pre>
  <p><img src="https://i.stack.imgur.com/mbdQL.gif" alt="runner up" /></p>