PHP – Safely serialize and unserialze arrays

October 14, 2010

Serializing arrays in PHP is a great way to format their content before storing it in a database. However, if the serialized content has certain characters (such as “;” or “:”) the resulting string won’t be read correctly by the unserialize() function, which is a huge bummer. So, here’s a workaround.