Is there an elegant way to emulate a destructor in PHP4?

register_shutdown_function() won't work, since it doesn't get called if the object is unset() or reassigned, etc.

Any thoughts? Thanks very much.