Here is my code:

<code>
if (!isset($cookie_cart)){
$cookie_cart = array();
}
$string = $quantity . "x " . $size . " " . $item;

$cookie_cart[] = $string;

setcookie("cookie_cart", $cookie_cart, time()+1800);
</code>

I want it to check to see if the variable $cookie_cart is set. If it is, then it is set as an array and I can continute. If it isn't, then it sets it as an array. I get an error because it claims that $cookie_cart is not an array and that I cant use '[]' with strings. Any ideas why this is happening?

Thanks.