title: Check if session is set or not, and if not create one?
body: <p>I want to check if a session is currently set, and if so do allow the page to run as normal (do nothing) if not create a session.</p>
  
  <p>I had a look at another SO question, in which the following code was posted:</p>
  
  <pre><code>if ( empty( $_SESSION['login'] )) { } else { }
  </code></pre>
  
  <p>Would the easiest way to do this be to set something like <code>$_SESSION['a']</code> for each session, and then run <code>if(empty($_SESSION['a']))</code> to check if a session exists?</p>
  
  <p>Then again, can you use a session variable without invoking session_start() in the first place, thus making it obsolete (I tried this yesterday, as an echo though, not an if statement to check that a variable was carrying through without realizing that session_start() needed to be invoked before I could echo the variable).</p>
  
  <p>There's probably an easy way that's oft used, I just can't seem to find it.</p>
  
  <p>Any help would be greatly appreciated!</p>