Do you mean "encrypt" or "encode"? The answer for both is structured the same, but the specifics are different.
Encodings:
Check out base64-encoding, which works brilliantly on both Go and PHP.
Encryption:
Check out AES-256-CBC, which should be supported by both. Just make sure to bake in the IV you use and keep the key secret (stored on the server) or something. If you don't want to do the padding/depadding yourself you could use OFB, which should also be supported by both.
Another option you have is to store the data that you want to save in a database (both PHP and Go have MySQL bindings available) and then you don't have to encrypt/decrypt or encode/decode anything, you just give the user a special key that points into the database (and use some smarts to make sure it's the same IP/UserAgent/etc that's giving you the key).
HTH,
--
~Kyle
"Everyone knows that debugging is twice as hard as writing a program in the first place. So if you're as clever as you can be when you write it, how will you ever debug it?"
— Brian Kernighan