title: Converting Session $data Into An Array?
body: <p>In the write function for a session save handler $data is passed in a format like this:</p>
  
  <blockquote>
    <p>test|a:1:{s:3:"foo";s:3:"bar";}session|a:2:{s:10:"isLoggedIn";b:1;s:8:"clientId";s:5:"12345
    ";}</p>
  </blockquote>
  
  <p>Is there a way to convert that into the proper array which would be:</p>
  
  <pre><code>array
  (
      'test' =&gt; array
      (
          'foo' =&gt; 'bar'
      )
      'session' =&gt; array
      (
          'isLoggedIn' =&gt; true
          'clientId' =&gt; '12345'
      )
  )
  </code></pre>
  
  <p>I tried passing that into unserialize but I get an error of:</p>
  
  <blockquote>
    <p>unserialize() [function.unserialize]: Error at offset 0 of 95 bytes</p>
  </blockquote>
  
  <p>and it just return false.</p>