On 18 Apr 2005 07:01:01 -0700,
google@zulan.net (Thomas Ilsche) wrote:
[color=blue]
>how do I "explicitly destroy" an Object in PHP5 to make sure the
>destructor is called an the object destroyed?[/color]
Remove all references to the object.
[color=blue]
>unset is not an option because there are multiple variables containing
>the object handle.[/color]
If you were to explicitly destroy the object than these multiple
variables would reference a destroyed object -- that would not be a
good thing.
The best option is still to remove all the references.
[color=blue]
>So what else could be done to "explicitly destroy" the object?
>If i simply call __destruct it would be called twice, bad aswell.[/color]
Use a flag to prevent __destruct from doing anything more the second
time it's called. What is going on in your destructor anyway?
[color=blue]
>Since I have intensively searched the manual I fear there is no C++
>like "delete Obj" construct in PHP. I really wonder why this is not
>the case since destructors exist and the other OOP features of PHP5
>seem really fine.[/color]
C++ doesn't have garbage collection which is why it has delete. PHP
has garbage collection so delete isn't needed.