PHP 8.5.0 Alpha 4 available for testing

Voting

: max(five, one)?
(Example: nine)

The Note You're Voting On

grzeniufication
9 years ago
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);
}

}

<< Back to user notes page

To Top