note 52229 deleted from language.oop by felipe

From: Date: Wed, 23 Apr 2008 11:33:53 +0000
Subject: note 52229 deleted from language.oop by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-138686@lists.php.net to get a copy of this message
Note Submitter: Niels Jaeckel ---- My problem was, to write a class-method, that destroyes the class itself. After many hours I found the (assured) only possibility to implement this: class A { function A() { } function DESTROY() { // this would not work: // unset($this); // but this: settype(&$this, 'null'); } } This test-code worked on PHP 4.3.1: $objA = new A(); var_dump($objA); // Object... $objA -> DESTROY(); var_dump($objA); // NULL !!! hth, Niels

« previous php.notes (#138686) next »