A random string

function generate_random_string($length = 16) {

      $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';

      $characters_length = strlen($characters);

      $random_string = '';

      for ($i = 0; $i < $length; $i++) {
          $random_string .= $characters[rand(0, $characters_length - 1)];
      }

   return $random_string;
}