PHP & Zend Engine (50 Qs)•Part 3: Production Tuning, Asynchronous Workers & High Scale (25 - 35)
Weak References and `WeakMap` in PHP.
senior LevelAsync & Promises
In Simple Words:
WeakReference: Allows referencing an object without increasing itsrefcount.WeakMap: A map where keys are objects. When an object key is unset or goes out of scope anywhere in the application, the entry is automatically removed from the WeakMap, preventing memory leaks when building object caches or metadata registries.