note 116289 added to oop4.magic-functions
| From: | Ninsuo | Date: | Sat, 06 Dec 2014 13:34:42 +0000 |
| Subject: | note 116289 added to oop4.magic-functions | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-201079@lists.php.net to get a copy of this message | ||
If you want to serialize all but one properties, you can use:
<?php
class MyClass
{
protected $a;
protected $b;
protected $c;
protected $d; // unwanted
public function __sleep()
{
return array_diff(get_object_vars($this), array('d'));
}
}
----
Server IP: 72.52.91.14
Probable Submitter: 92.90.16.189
----
Manual Page -- http://php.net/manual/en/oop4.magic-functions.php
Edit -- https://master.php.net/note/edit/116289
Del: integrated -- https://master.php.net/note/delete/116289/integrated
Del: useless -- https://master.php.net/note/delete/116289/useless
Del: bad code -- https://master.php.net/note/delete/116289/bad+code
Del: spam -- https://master.php.net/note/delete/116289/spam
Del: non-english -- https://master.php.net/note/delete/116289/non-english
Del: in docs -- https://master.php.net/note/delete/116289/in+docs
Del: other reasons-- https://master.php.net/note/delete/116289
Reject -- https://master.php.net/note/reject/116289
Search -- https://master.php.net/manage/user-notes.php