note 118263 deleted from class.serializable by cmb

From: Date: Wed, 16 Dec 2015 16:07:19 +0000
Subject: note 118263 deleted from class.serializable by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-204420@lists.php.net to get a copy of this message
Note Submitter: grzeniufication ---- 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); } }

« previous php.notes (#204420) next »