I am working on localhost. I have already a cookie is created with two keys. i want to store the third key, but i couldn't save this third key inside the cookie. It always return null. Also this new key is not available after page refresh. Here is my code
$cart_data = array ('1','2');
$test = setcookie('user_cart', serialize($cart_data), time() + (60 * 20),'/',false,false,false);
var_dump($test);
die;
// Checking output like this. (This code is in other file)
if(isset($_COOKIE['user_cart'])){
echo '<pre>';
print_r($_COOKIE);
die;
}