note 32225 deleted from control-structures.foreach by sniper

From: Date: Wed, 08 Oct 2003 04:04:59 +0000
Subject: note 32225 deleted from control-structures.foreach by sniper
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-58002@lists.php.net to get a copy of this message
Note Submitter: Storm ---- Using this for a class CAN be useful if you want to destroy vars inside the class from inside the class... class ... { // vars... function destroy() { foreach ($this as $var=>$val) { if ($var != 'Some var we want to keep') { unset($this->{$var}); } } } } It works great when you want to destroy all of the class variables of a database class except for the connection status so that you can still use that status for other parts of your external script... I guess ;)

« previous php.notes (#58002) next »