I wanted to store an array in a cookie, so I wrote these two functions:
function encode_arr($data) {
return base64_encode(serialize($data));
}
function decode_arr($data) {
return unserialize(base64_decode($data));
}
return base64_encode(serialize($data));
}
function decode_arr($data) {
return unserialize(base64_decode($data));
}
Leave a comment