WeakMap
final class WeakMap implements ArrayAccess, Countable, IteratorAggregate (View source)
Weak maps allow creating a map from objects to arbitrary values (similar to SplObjectStorage) without preventing the objects that are used as keys from being garbage collected. If an object key is garbage collected, it will simply be removed from the map.
Methods
Returns {true} if the value for the object is contained in the {WeakMap} and {false} instead.
Returns the existsing value by an object.
Sets a new value for an object.
Force removes an object value from the {WeakMap} instance.
Returns an iterator in the "[object => mixed]" format.
Returns the number of items in the {WeakMap} instance.
Details
bool
offsetExists(TKey $object)
Returns {true} if the value for the object is contained in the {WeakMap} and {false} instead.
mixed
offsetGet(TKey $object)
Returns the existsing value by an object.
void
offsetSet(TKey $object, TValue $value)
Sets a new value for an object.
void
offsetUnset(TKey $object)
Force removes an object value from the {WeakMap} instance.
Traversable
getIterator()
Returns an iterator in the "[object => mixed]" format.
int
count()
Returns the number of items in the {WeakMap} instance.