title: Having trouble unsetting session variable in Yii2
body: <p>I'm using <code>Yii2</code> and I have just started working with <code>sessions</code> within it. I have read the <a href="http://www.yiiframework.com/doc-2.0/guide-runtime-sessions-cookies.html" rel="nofollow">documentation</a> for them on the Yii site.</p>
  
  <p>One thing I noticed is it is a bit hard to work with multi-dimensional arrays in sessions without using the standard superglobal <code>$_SESSION</code> and hence I have mainly been using that.</p>
  
  <p>One thing I am having trouble doing though is unsetting a session variable.</p>
  
  <p>Example:</p>
  
  <pre><code>if (!Yii::$app-&gt;session-&gt;isActive) {
      Yii::$app-&gt;session-&gt;open();
  }
  
  print_r($_SESSION['foo']);
  
  if ($this-&gt;command == 'sample_action') {
  
      if (!isset($_SESSION['foo'][$this-&gt;some_id][$this-&gt;example_id])) {
          $_SESSION['foo'][$this-&gt;some_id][$this-&gt;example_id] = $this-&gt;example_id;
          $result = true;
      }
  
  } elseif ($this-&gt;command == 'sample_action_2') {
  
      if (isset($_SESSION['foo'][$this-&gt;some_id][$this-&gt;example_id])) {
          unset($_SESSION['foo'][$this-&gt;some_id][$this-&gt;example_id]);
          //$_SESSION['foo'][$this-&gt;some_id][$this-&gt;example_id] = ''; // This works
          $result = true;
      }           
  
  }
  
  print_r($_SESSION['foo']);
  </code></pre>
  
  <p>Using <code>unset</code> on it doesn't work at all, it still remains. Setting it to a blank value works however.</p>