note 55845 added to function.unserialize

From: Date: Mon, 15 Aug 2005 11:48:39 +0000
Subject: note 55845 added to function.unserialize
Groups: php.notes 
Request: Send a blank email to php-notes+get-93676@lists.php.net to get a copy of this message
When you use sessions, its very important to keep the sessiondata small, due to low performance with unserialize. Every class shoud extend from this class. The result will be, that no null Values are written to the sessiondata. It will increase performance. <? class BaseObject { function __sleep() { $vars = (array)$this; foreach ($vars as $key => $val) { if (is_null($val)) { unset($vars[$key]); } } return array_keys($vars); } }; ?> ---- Manual Page -- http://www.php.net/manual/en/function.unserialize.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+55845 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+55845&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+55845&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+55845&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+55845&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+55845&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+55845&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+55845&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#93676) next »