note 118264 added to class.serializable

From: Date: Thu, 05 Nov 2015 21:19:44 +0000
Subject: note 118264 added to class.serializable
Groups: php.notes 
Request: Send a blank email to php-notes+get-204090@lists.php.net to get a copy of this message
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); } } ---- Server IP: 72.52.91.14 Probable Submitter: 79.186.190.45 ---- Manual Page -- http://php.net/manual/en/class.serializable.php Edit -- https://master.php.net/note/edit/118264 Del: integrated -- https://master.php.net/note/delete/118264/integrated Del: useless -- https://master.php.net/note/delete/118264/useless Del: bad code -- https://master.php.net/note/delete/118264/bad+code Del: spam -- https://master.php.net/note/delete/118264/spam Del: non-english -- https://master.php.net/note/delete/118264/non-english Del: in docs -- https://master.php.net/note/delete/118264/in+docs Del: other reasons-- https://master.php.net/note/delete/118264 Reject -- https://master.php.net/note/reject/118264 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#204090) next »