note 11999 added to language.oop.php
| From: | kellewic at yahoo dot com | Date: | Sat, 17 Mar 2001 02:01:06 +0000 |
| Subject: | note 11999 added to language.oop.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-12494@lists.php.net to get a copy of this message | ||
Regarding destructors why can't you just create a function that does the cleanup for you? Ex:
function destroy(){
... cleanup code here ...
}
Then inside your script:
$obj->destroy;
unset $obj;
or even:
function destroy(){
... cleanup code here ...
unset $this;
}
Inside script:
$obj->destroy;
Of course I am unsure if PHP will let you unset the obj from within the class?
Granted, it's not a destructor that is called automagically when the object goes out of scope,
but it's better than nothing at all.
NOTE:
I have not used PHP since 3.06 was released and use Perl for CGI. With all the new developments
since 3.06 I figured I'd look back into PHP... object-wise, though, it's not looking any
better than Perl.
http://www.php.net/manual/en/language.oop.php