Encode Array as String

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));
}
Posted in

Leave a comment

Leave a Reply

Your email address will not be published. Required fields are marked *