title: PHP Do something(process $_SESSION) when session ends
body: <p>I want to gather user logs in a session and save it in the DB when the session is about to be deleted.<br>
  I couldn't find an answer which does not involve storing a Session ID in the DB and timers.</p>
  
  <p>But... session is a server side feature, right?<br>
  The Server decides which session has ended and the server deletes it.</p>
  
  <p>Is there really no way to call user script to process $_SESSION right before it gets deleted?</p>