PHP: Destroy an object from within the object?

Spot picture Spot · Sep 12, 2009 · Viewed 8.6k times · Source

Is there a way in PHP to destroy an object from within that same object?

Answer

VolkerK picture VolkerK · Sep 12, 2009

If a method is called in the object's context then there has to be at least one reference to that object. And since php only removes unreachable objects the answer is: no.