I've done a bit of digging and I have attached a fragment from a class that saves a shopping basket in the session. Since shoving arrays in the session can be messy it converts the basket data (two arrays) to two strings and saves them in two session variables.
On the load of the next page, the class's initialisation checks to see if the session contains variables indicating that a basket is in use. If it finds them it uses UNSERIALIZE to unpack the strings back into arrays and then assigns them to class properties.