Why not use `serialize` or `json_encode` - something actually designed for this kind of purpose?