<?php
function randomString($strLen = 32)
{
  // Create our character array
  $chrs = array_merge(range('a', 'z'), range('A', 'Z'), range(0, 9));

  // Just to make the output even more random
  shuffle($chrs);

  // Create a holder for our string
  $randStr = '';

  // Now loop through the desired number of characters for our string
  for($i=0;$i<$strLen;$i++)
  {
    $randStr .= $chrs[mt_rand(0, (count($chrs) - 1))];
  }
  return $randStr;
}

echo randomString();
?>