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