title: PHP how to stringify array and store in cookie
body: <p>I got an array like this</p>
  
  <p>$value = {array('id'=>$id, 'email'=>$email, 'token'=>$token)}</p>
  
  <p>I want to stringify the array then encode then store it in cookie "login". How do you do that ? Also please tell me how to decode and read the stored value.</p>
  
  <p>Edit:</p>
  
  <p>I've been trying serialize/unserialize, but it didn't work as expected. for example,</p>
  
  <pre><code>$value = serialize(array('id'=&gt;33, 'email'=&gt;'big@gmail.com', 'token'=&gt;'e9aa0966773d68e0fbf9cb21fc2877b4'));
  
  echo $value; //a:3:{s:2:"id";i:33;s:5:"email";s:20:"big@gmail.com";s:5:"token";s:32:"e9aa0966773d68e0fbf9cb21fc2877b4";}
  </code></pre>
  
  <p>But when the value go to cookie, it looks like this</p>
  
  <pre><code>a%3A3%3A%7Bs%3A2%3A%22id%22%3Bs%3A1%3A%226%22%3Bs%3A5%3A%22email%22%3Bs%3A20%3A%22craigcosmo%40gmail.com%22%3Bs%3A5%3A%22token%22%3Bs%3A32%3A%22e9aa0966773d68e0fbf9cb21fc2877b4%22%3B%7D
  </code></pre>