Subscribe to PHP Freaks RSS

PHP 8.0 feature focus: <span>Weak maps</span>

syndicated from on September 30, 2020

In our last episode, we discussed PHP 8’s new match() expression. Today we look at an edge case feature that will save your edge case. PHP 7.4 introduced the concept of Weak References, which allow an object to be referenced without incrementing its reference counter. That’s a bit obscure and in practice not all that useful in most cases. What we were really waiting for is Weak Maps, which have landed in PHP 8.