Here's an example how to un-, serialize more than one property:
class Example implements \Serializable
{
protected $property1;
protected $property2;
protected $property3;
public function __construct($property1, $property2, $property3)
{
$this->property1 = $property1;
$this->property2 = $property2;
$this->property3 = $property3;
}
public function serialize()
{
return serialize([
$this->property1,
$this->property2,
$this->property3,
]);
}
public function unserialize($data)
{
list(
$this->property1,
$this->property2,
$this->property3
) = unserialize($data);
}
}