title: Generating a unique ID in PHP
body: <p>I'm trying to generate a unique ID in php in order to store user-uploaded content on a FS without conflicts.  I'm using php, and at the moment this little snippet is responsible for generating the UID:</p>
  
  <pre><code>$id = tempnam (".", "");
  unlink($id);
  $id = substr($id, 2);
  </code></pre>
  
  <p>This code is hideous: it creates a temporary file on the FS and deletes it, retaining only the relevant unique part of the generated string.</p>
  
  <p>Is there any better way to do this, most preferably without any external dependencies?</p>
  
  <p>Thanks much!</p>