I am trying to figure out why this does not work. I am trying add and remove elements to an array that is stored in a cookie in a comma delimited fashion such as "1,2,3,4,5" and then echo the array size. With the arrangement of the php as I have it below, the array size is not updating after the elements have been added to the array when I run the php in a browser. It only updates the array the second time I run the php in a browser. Can someone please assist me with the correct php so that the php will add the elements and update the array size? Thank you.
<?
setcookie ("values", "1,2,3,4,5", time()+1000);
$aCookie = explode(",",$_COOKIE['values']);
$aCookieSize = count($aCookie);
echo $aCookieSize;
?>