Icon
Icon
Icon
Icon
Icon
Icon
12:34 AM
0 comments


delete statement
Background
In the original object model there is no way to force deletion of an object if there are still
references to it.
Need
With the new centralized objects we believe that in certain cases developers will want to
force an object to be destroyed at a certain point in their program. It might initially seem
trivial to do  $obj = NULL, however, as unexpected variables might still be holding a
reference to this object the effect of the previous statement might not free the object at the
wanted time. There should be a way to force the Zend Engine to destroy and object even
if there are still references to it.
Overview
The proposed  delete statement will address this problem. It will call the object’s
destructor and free it even if the object is referenced by some other places in the engine.
Other references to the deleted object will become stale and trying to access them will
result in a fatal error.
Functionality
As mentioned in the overview section, the  delete statement will force the object’s
destruction.
The syntax will be:

delete $object;

Compatibility notes
No compatibility issues, as this feature doesn’t exist in previous versions of the scripting
engine.  Dependencies of feature
This feature is dependent on the new object model.

If You Enjoyed This Post Please Take a Second To Share It.

You Might Also Like

Stay Connected With Free Updates

Subscribe via Email

teaser