You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$x = newWeakRef($obj);
$x->onLoss(function() use($map){
echo"the object was garbage collected";
$map->remove($weakref);
});
// or even...$x->onBeforeLoss(function($object){
echo"the object is about to be garbage collected";
$map->save($object->serialize());
// $weakref->acquire(); -> triggers "you aren't allowed to acquire a strong reference here"
});