I got an array like this
$value = {array(\'id\'=>$id, \'email\'=>$email, \'token\'=>$token)}
I want to stringify the array then encode then store it in cooki
there is a serialize/unserialize function to convert an array to a string and back.
Edit: When you store a string to cookie (setcookie), php needs to do a url encode on the string. This prevents any characters in the string saved to cookie interfering with any other headers. When the page is loaded next, php gets the cookie and automatically does a url decode on the cookie value to return it to it's previous value. As far as what is stored in the cookie, this shouldn't matter within php because php will do the url encode/decode automatically. Now if you are getting the cookie in another language such as javascript, then yes, you will get the raw string back. In this case you can use something like decodeURI in JS to get the original value back.