title: Unserialize cookie variable
body: <p>Thank for viewing my question.</p>
  
  <p>the code:</p>
  
  <pre><code>$array = array("zero","one","true","three");
  echo $beforecookie = serialize($array); //&lt;&lt;-- IT WORKS;
  print_r(unserialize($beforecookie)); //&lt;&lt;--IT WORKS
  
  setcookie('mycookie', $beforecookie, time()+3600);
  echo $aftercookie = $_COOKIE['mycookie']; // &lt;&lt;-- it works perfectly same with $beforecookie
  
  $data = unserialize($aftercookie);
  print_r($data); //&lt;&lt;--RETURN NOTHING (the problem)
  var_dump($data); //&lt;&lt;-- RETURN bool(false);
  </code></pre>
  
  <p>The string(serialized from the array) that I got from cookie can't be unserialized; why? how can I get the array back after set it to the cookie with serialize()? or maybe I missed something?</p>
  
  <p>Thanks for the help.</p>