1<?php
2class ClassThatImplementsSerializable implements Serializable
3{
4    public function serialize()
5    {
6        return get_object_vars($this);
7    }
8
9    public function unserialize($serialized)
10    {
11        foreach (unserialize($serialized) as $key => $value) {
12            $this->{$key} = $value;
13        }
14    }
15}
16