title: Store a complete array in a cookie
body: <p>I have the following array:</p>
  
  <blockquote>
    <p>Array ( [0] => 1 
              [1] => 1 
              [2] => 3 
              [3] => 6 )</p>
  </blockquote>
  
  <p>and I would like to store it in a cookie.  This is the code I tried:</p>
  
  <pre><code>$cart_array = Array ( [0] =&gt; 1 
            [1] =&gt; 1 
            [2] =&gt; 3 
            [3] =&gt; 6 );
  
  setcookie('cart_array',$cart_array,time()+3600);
  </code></pre>
  
  <p>when I display the contents of the cookie using <code>print_r($_Cookie)</code>, this is what I get:</p>
  
  <blockquote>
    <p>Array ( [cart] => Array ( [0] => 6 [id] => 2 ) [_ga] => GA1.1.499529088.1424453778 [PHPSESSID] => aj8p5l5ph77n04tab50i83ie34 ) </p>
  </blockquote>
  
  <p>instead of the array I inserted to cookie. Please assist</p>