title: PHP - Foreach look giving a warning
body: <p>I made a login page and while navigating from one page to another I'd like to destroy the unnecessary sessions</p>
  
  <pre><code>$keepSessions = array('vendor_id','email_login','user_password','passport_id');
      foreach($_SESSION as $sessionKey){
          if (!in_array($sessionKey,$keepSessions)) {
              unset($_SESSION[$sessionKey]);
          }
      }
  </code></pre>
  
  <p>Unfortunately I get the following error PHP Warning:  Illegal offset type in unset</p>
  
  <p>I cannot seem to find a solution that uses the foreach and $_SESSION to elimate the above error</p>