The WeakRef class
WeakRef
&reftitle.intro;
The WeakRef class provides a gateway to objects without preventing the garbage collector from freeing those objects.
It also provides a way to turn a weak reference into a strong one.
&reftitle.classsynopsis;
WeakRef
WeakRef
&Methods;
&reftitle.examples;
WeakRef usage example
valid()) {
echo "Object still exists!\n";
var_dump($r1->get());
} else {
echo "Object is dead!\n";
}
unset($o1);
if ($r1->valid()) {
echo "Object still exists!\n";
var_dump($r1->get());
} else {
echo "Object is dead!\n";
}
?>
]]>
&example.outputs;
&reference.weakref.entities.weakref;