note 28177 added to ref.objaggregation

From: Date: Sat, 04 Jan 2003 21:54:54 +0000
Subject: note 28177 added to ref.objaggregation
Groups: php.notes 
Request: Send a blank email to php-notes+get-41671@lists.php.net to get a copy of this message
If you need to serialize an object for sessions or other purposes, and want to save aggregation state, extend it from a base class such as this one, and use $this->agg/$this->unagg instead of aggregate/deaggregate <?php class base { var $_aggregates = array(); function agg($agg) { aggregate($this,$agg); $this->_aggregates[$agg] = 1; } function unagg($agg = false) { if ($agg) { deaggregate($this,$agg); unset($this->_aggregates[$agg]); } else { deaggregate($this); $this->_aggregates = array(); } } } ?> -- http://www.php.net/manual/en/ref.objaggregation.php http://master.php.net/manage/user-notes.php?action=edit+28177 http://master.php.net/manage/user-notes.php?action=delete+28177 http://master.php.net/manage/user-notes.php?action=reject+28177

« previous php.notes (#41671) next »