php - Store bidimensional array from Javascript in Cookie -


first of all, that's reading , trying me!

i got online shop , have bi-dimensional array products that:

 1. $arrayproducts[id][0] -> id  2. $arrayproducts[id][1] -> product name  3. $arrayproducts[id][2] -> price 

etc..

i know isn't best way system, it's done that.

now, want store bi-dimensional array in cookie, because want store cart user if go away page, , load again when come back.

i think best way cookie, don't know if should json_encode , json_decode bi-dimensional array, or best way fix problem.

before saving data cookie stringify array.

var x = json.stringify(yourarrayvar); 

then save x in cookie.


Comments

Popular posts from this blog

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - UML - How would you draw a try catch in a sequence diagram? -

c++ - No viable overloaded operator for references a map -