note 52229 added to language.oop
| From: | NielsJaeckel at osu1 dot php dot net | Date: | Mon, 25 Apr 2005 08:37:48 +0000 |
| Subject: | note 52229 added to language.oop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-88517@lists.php.net to get a copy of this message | ||
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
----
Manual Page -- http://www.php.net/manual/en/language.oop.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+52229
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+52229&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+52229&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+52229&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+52229&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+52229&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+52229&report=yes
Search -- http://master.php.net/manage/user-notes.php