How can I store multiple values in a single cookie and keep adding more values in the same cookie.
For example:
If a user_id 1 votes a post_id 1, i want to store (1, 1) in the cookie.
If the user_id 1 votes a post_id 2, I want to update the same cookie with values (1,2).
Thanks.
use json to store array in single cookie
set cookie:
setcookie("myCookie", json_encode(array(1, 2)));
get cookie:
print_r(json_encode($_COOKIE["myCookie"]));