Skip to main content
InterviewHubPRO
Section Overview
Q44

Question 44 of 50

Part 3: Production Tuning, Asynchronous Workers & High Scale (25 - 35)

88%
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 its refcount.
  • 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.