If you have non-scalar values you should serialize and unserialize them. You have multiple options:
- PHP's serialize and unserialize
- JSON encode and decode
As a general rule, if you put any value in HTML you need to encode its HTML special chars.
Use case: