title: How do PHP sessions work? (not "how are they used?")
body: <p>Session files are usually stored in, say, <code>/tmp/</code> on the server, and named <code>sess_{session_id}</code>. I have been looking at the contents and cannot figure out how they really work.</p>
  
  <p>Fetching the variable name and and content from the file is easy. But how does PHP know what session belongs to whom?</p>
  
  <p>The session_id seems totally random and one IP address can have several users, and each user can have several sessions if they have more than one browser window open.</p>
  
  <p>So how does it work?</p>