title: PHP Session Not Restoring from Cookies
body: <p>When a user returns to my website, it attempts to restore their last session from the <code>$_COOKIE</code> associative array.  It's not working as expected.  I can look in my browser's cookie manager and see that the cookies are there, but they don't seem to be getting saved to the <code>$_SESSION</code> associative array.</p>
  
  <p>This is essentially the program flow when a user returns to my site:</p>
  
  <pre><code>foreach ( $_COOKIE as $name =&gt; $val )
  {
    $_SESSION[$name] = $val;
  }
  
  session_start();
  
  ...
  
  $some_var = $_SESSION[$var_name];
  </code></pre>
  
  <p>Do I have things out of order, or should I not be overwriting <code>PHPSESSID</code>?  Any insight as to what I'm doing wrong would be appreciated.  Thanks.</p>