CINXE.COM
PHP: rfc:weak_maps
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>PHP: rfc:weak_maps</title> <meta name="generator" content="DokuWiki"/> <meta name="robots" content="index,follow"/> <meta name="keywords" content="rfc,weak_maps"/> <link rel="search" type="application/opensearchdescription+xml" href="/lib/exe/opensearch.php" title="PHP Wiki"/> <link rel="start" href="/"/> <link rel="contents" href="/rfc/weak_maps?do=index" title="Sitemap"/> <link rel="manifest" href="/lib/exe/manifest.php"/> <link rel="alternate" type="application/rss+xml" title="Recent Changes" href="/feed.php"/> <link rel="alternate" type="application/rss+xml" title="Current namespace" href="/feed.php?mode=list&ns=rfc"/> <link rel="alternate" type="text/html" title="Plain HTML" href="/_export/xhtml/rfc/weak_maps"/> <link rel="alternate" type="text/plain" title="Wiki Markup" href="/_export/raw/rfc/weak_maps"/> <link rel="canonical" href="https://wiki.php.net/rfc/weak_maps"/> <link rel="stylesheet" href="/lib/exe/css.php?t=phpnet&tseed=da24444b949712713b97802ec0312cde"/> <!--[if gte IE 9]><!--> <script >/*<![CDATA[*/var NS='rfc';var JSINFO = {"id":"rfc:weak_maps","namespace":"rfc","ACT":"show","useHeadingNavigation":0,"useHeadingContent":0}; /*!]]>*/</script> <script src="/lib/exe/jquery.php?tseed=f0349b609f9b91a485af8fd8ecd4aea4" defer="defer">/*<![CDATA[*/ /*!]]>*/</script> <script src="/lib/exe/js.php?t=phpnet&tseed=da24444b949712713b97802ec0312cde" defer="defer">/*<![CDATA[*/ /*!]]>*/</script> <!--<![endif]--> <link media='all' rel='stylesheet' href='//shared.php.net/styles/defaults.css?filemtime=1630005818'/> <link media='all' rel='stylesheet' href='//shared.php.net/styles/wiki.css?filemtime=1630005818'/> <link href="//fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,400italic,600italic|Source+Code+Pro&subset=latin,latin-ext" rel="stylesheet"> <link rel="shortcut icon" href="//php.net/favicon.ico"> <!--[if lt IE 9]> <script src="//shared.php.net/js/html5shiv.js"></script> <![endif]--> </head> <body id=""> <div class="wrap"> <header class='clearfix'> <div id="mainmenu-toggle-overlay"></div> <input type="checkbox" id="mainmenu-toggle"> <nav class="fullscreen"> <div class="mainscreen"> <a href="/" class="home"><img src="//php.net/images/logo.php?" width="48" height="24" alt="php"><span class="subdomain"></span></a> <ul> <li><a href="?do=login">Login</a></li> <li><a href="?do=register">Register</a></li> </ul> </div> <div class="secondscreen"> <form method="get" action="/start"> <input type="search" placeholder="Search" name="id" class="search"> <input type="hidden" name="do" value="search"> </form> </div> </nav> </header> <div id="flash-message"></div> <nav id="megadropdown"></nav> <section class="fullscreen clearfix"> <section id="breadcrumbs"> <nav> <span class="bchead">You are here: </span><span class="home"><bdi><a href="/start" class="wikilink1" title="start" data-wiki-id="start">start</a></bdi></span> › <bdi><a href="/rfc" class="wikilink1" title="rfc" data-wiki-id="rfc">rfc</a></bdi> › <bdi><a href="/rfc/weak_maps" class="wikilink1" title="rfc:weak_maps" data-wiki-id="rfc:weak_maps">weak_maps</a></bdi></nav> </section> <section class="mainscreen"> <!--[if lte IE 7 ]><div id="IE7"><![endif]--><!--[if IE 8 ]><div id="IE8"><![endif]--> <div id="dokuwiki__site"><div id="dokuwiki__top" class="site dokuwiki mode_show tpl_phpnet "> <div class="wrapper group"> <!-- ********** CONTENT ********** --> <div id="dokuwiki__content"><div class="pad group"> <div class="pageId"><span>rfc:weak_maps</span></div> <div class="page group"> <!-- wikipage start --> <h1 class="sectionedit1" id="php_rfcweak_maps">PHP RFC: Weak maps</h1> <div class="level1"> <ul> <li class="level1"><div class="li"> Date: 2019-11-04</div> </li> <li class="level1"><div class="li"> Author: Nikita Popov <a href="mailto:nikic@php.net" class="mail" title="nikic@php.net">nikic@php.net</a></div> </li> <li class="level1"><div class="li"> Proposed Version: PHP 8.0</div> </li> <li class="level1"><div class="li"> Status: Implemented</div> </li> <li class="level1"><div class="li"> Implementation: <a href="https://github.com/php/php-src/pull/4882" class="urlextern" title="https://github.com/php/php-src/pull/4882" rel="ugc nofollow">https://github.com/php/php-src/pull/4882</a></div> </li> </ul> </div> <h2 class="sectionedit2" id="introduction">Introduction</h2> <div class="level2"> <p> 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. </p> <p> In PHP 7.4 first-class support for <a href="/rfc/weakrefs" class="wikilink1" title="rfc:weakrefs" data-wiki-id="rfc:weakrefs">weak references</a> was already introduced. However, raw weak references are only of limited usefulness by themselves and weak maps are much more commonly used in practice. It is not possible to implement an efficient weak map on top of PHP weak references, because the ability to register a destruction callback is not provided. </p> <p> The general use case for weak maps is to associate data with individual object instances, without forcing them to stay alive and thus effectively leak memory in long-running processes. For example, a weak map may be used to memoize a computation result: </p> <div class="phpok"> <pre class="code php"><span class="kw2">class</span> FooBar <span class="br0">{</span> <span class="kw2">private</span> WeakMap <span class="re0">$cache</span><span class="sy0">;</span> <span class="kw2">public</span> <span class="kw2">function</span> getSomethingWithCaching<span class="br0">(</span>object <span class="re0">$obj</span><span class="br0">)</span> <span class="br0">{</span> <span class="kw1">return</span> <span class="re0">$this</span><span class="sy0">-></span><span class="me1">cache</span><span class="br0">[</span><span class="re0">$obj</span><span class="br0">]</span> ??<span class="sy0">=</span> <span class="re0">$this</span><span class="sy0">-></span><span class="me1">computeSomethingExpensive</span><span class="br0">(</span><span class="re0">$obj</span><span class="br0">)</span><span class="sy0">;</span> <span class="br0">}</span> <span class="co1">// ...</span> <span class="br0">}</span></pre></div> <p> This will invoke the <code>computeSomethingExpensive()</code> method only once for each object. At the same time it will also drop the cached value from the map if the object is destroyed. Doing the same with a normal array (or rather <code>SplObjectStorage</code>) would result in a memory leak. </p> </div> <h2 class="sectionedit3" id="proposal">Proposal</h2> <div class="level2"> <p> Add a <code>WeakMap</code> class with the following prototype: </p> <div class="phpok"> <pre class="code php">final <span class="kw2">class</span> WeakMap <span class="kw2">implements</span> ArrayAccess<span class="sy0">,</span> Countable<span class="sy0">,</span> Traversable <span class="br0">{</span> <span class="kw2">public</span> <span class="kw2">function</span> offsetGet<span class="br0">(</span><span class="re0">$object</span><span class="br0">)</span><span class="sy0">;</span> <span class="kw2">public</span> <span class="kw2">function</span> offsetSet<span class="br0">(</span><span class="re0">$object</span><span class="sy0">,</span> <span class="re0">$value</span><span class="br0">)</span><span class="sy0">:</span> void<span class="sy0">;</span> <span class="kw2">public</span> <span class="kw2">function</span> offsetExists<span class="br0">(</span><span class="re0">$object</span><span class="br0">)</span><span class="sy0">:</span> bool<span class="sy0">;</span> <span class="kw2">public</span> <span class="kw2">function</span> offsetUnset<span class="br0">(</span><span class="re0">$object</span><span class="br0">)</span><span class="sy0">:</span> void<span class="sy0">;</span> <span class="kw2">public</span> <span class="kw2">function</span> <a href="http://www.php.net/count"><span class="kw3">count</span></a><span class="br0">(</span><span class="br0">)</span><span class="sy0">:</span> int<span class="sy0">;</span> <span class="br0">}</span></pre></div> <p> Objects used as weak map keys are “weakly referenced”, which means that they are not prevented from being garbage collected. If an object that is used as a weak map key is garbage collected, the key is removed from the weak map. This is illustated in the following example: </p> <div class="phpok"> <pre class="code php"><span class="re0">$map</span> <span class="sy0">=</span> <span class="kw2">new</span> WeakMap<span class="sy0">;</span> <span class="re0">$obj</span> <span class="sy0">=</span> <span class="kw2">new</span> stdClass<span class="sy0">;</span> <span class="re0">$map</span><span class="br0">[</span><span class="re0">$obj</span><span class="br0">]</span> <span class="sy0">=</span> <span class="nu0">42</span><span class="sy0">;</span> <a href="http://www.php.net/var_dump"><span class="kw3">var_dump</span></a><span class="br0">(</span><span class="re0">$map</span><span class="br0">)</span><span class="sy0">;</span> <span class="co1">// object(WeakMap)#1 (1) {</span> <span class="co1">// [0]=></span> <span class="co1">// array(2) {</span> <span class="co1">// ["key"]=></span> <span class="co1">// object(stdClass)#2 (0) {</span> <span class="co1">// }</span> <span class="co1">// ["value"]=></span> <span class="co1">// int(42)</span> <span class="co1">// }</span> <span class="co1">// }</span> <span class="co1">// The object is destroyed here, and the key is automatically removed from the weak map.</span> <a href="http://www.php.net/unset"><span class="kw3">unset</span></a><span class="br0">(</span><span class="re0">$obj</span><span class="br0">)</span><span class="sy0">;</span> <a href="http://www.php.net/var_dump"><span class="kw3">var_dump</span></a><span class="br0">(</span><span class="re0">$map</span><span class="br0">)</span><span class="sy0">;</span> <span class="co1">// object(WeakMap)#1 (0) {</span> <span class="co1">// }</span></pre></div> <p> Some details of the <code>WeakMap</code> behavior are outlined in the following: </p> <ul> <li class="level1"><div class="li"> Just like <code>WeakReference</code>, <code>WeakMap</code> is not serializable and setting dynamic properties on it is forbidden.</div> </li> <li class="level1"><div class="li"> Unlike <code>WeakReference</code>, <code>WeakMap</code> can be cloned. Cloning <code>WeakReference</code>s is not allowed because the objects are uniqued, which does not apply to <code>WeakMap</code>s.</div> </li> <li class="level1"><div class="li"> Using a non-object key in <code>$map[$key]</code> or one of the <code>offset*()</code> methods results in a <code>TypeError</code> exception.</div> </li> <li class="level1"><div class="li"> Appending to a weak map using <code>$map[]</code> results in an <code>Error</code> exception.</div> </li> <li class="level1"><div class="li"> Reading a non-existent key results in an <code>Error</code> exception.</div> </li> <li class="level1"><div class="li"> Overloaded operations on map entries are supported, i.e. <code>$map[$obj][] = $x</code> and similar work.</div> </li> <li class="level1"><div class="li"> By-reference iteration of <code>WeakMap</code>s is supported.</div> </li> </ul> </div> <h2 class="sectionedit4" id="backward_incompatible_changes">Backward Incompatible Changes</h2> <div class="level2"> <p> No backwards incompatible changes apart from using the <code>WeakMap</code> class name. </p> </div> <h2 class="sectionedit5" id="vote">Vote</h2> <div class="level2"> <p> Voting started 2019-12-18 and closes 2020-01-01. </p> <!-- Doodle Plugin --> <form action="/start" method="post" name="doodle__form" id="doodle__form__add_weakmap_class_in_php_8.0" accept-charset="utf-8" > <input type="hidden" name="sectok" value="" /> <input type="hidden" name="do" value="show" > <input type="hidden" name="id" value="rfc:weak_maps" > <input type="hidden" name="formId" value="doodle__form__add_weakmap_class_in_php_8.0" > <input type="hidden" name="edit__entry" value=""> <input type="hidden" name="delete__entry" value=""> <table class="inline"> <tbody> <tr class="row0"> <th class="centeralign" colspan="3"> Add WeakMap class in PHP 8.0? </th> </tr> <tr class="row1"> <th class="col0">Real name</th> <td class="centeralign">Yes</td> <td class="centeralign">No</td> </tr> <tr> <td class="rightalign"> <a href="//people.php.net/alcaeus">alcaeus</a> (alcaeus) </td> <td class="centeralign" style="background-color:#AFA"><img src="/lib/images/success.png" title="2019/12/18 16:06"></td><td class="centeralign" style="background-color:#FCC"> </td> </tr> <tr> <td class="rightalign"> <a href="//people.php.net/asgrim">asgrim</a> (asgrim) </td> <td class="centeralign" style="background-color:#AFA"><img src="/lib/images/success.png" title="2019/12/20 09:06"></td><td class="centeralign" style="background-color:#FCC"> </td> </tr> <tr> <td class="rightalign"> <a href="//people.php.net/ashnazg">ashnazg</a> (ashnazg) </td> <td class="centeralign" style="background-color:#AFA"><img src="/lib/images/success.png" title="2019/12/18 12:44"></td><td class="centeralign" style="background-color:#FCC"> </td> </tr> <tr> <td class="rightalign"> <a href="//people.php.net/cmb">cmb</a> (cmb) </td> <td class="centeralign" style="background-color:#AFA"><img src="/lib/images/success.png" title="2019/12/19 08:46"></td><td class="centeralign" style="background-color:#FCC"> </td> </tr> <tr> <td class="rightalign"> <a href="//people.php.net/derick">derick</a> (derick) </td> <td class="centeralign" style="background-color:#AFA"><img src="/lib/images/success.png" title="2019/12/18 13:35"></td><td class="centeralign" style="background-color:#FCC"> </td> </tr> <tr> <td class="rightalign"> <a href="//people.php.net/galvao">galvao</a> (galvao) </td> <td class="centeralign" style="background-color:#AFA"><img src="/lib/images/success.png" title="2019/12/18 14:24"></td><td class="centeralign" style="background-color:#FCC"> </td> </tr> <tr> <td class="rightalign"> <a href="//people.php.net/geekcom">geekcom</a> (geekcom) </td> <td class="centeralign" style="background-color:#AFA"><img src="/lib/images/success.png" title="2019/12/19 14:43"></td><td class="centeralign" style="background-color:#FCC"> </td> </tr> <tr> <td class="rightalign"> <a href="//people.php.net/girgias">girgias</a> (girgias) </td> <td class="centeralign" style="background-color:#AFA"><img src="/lib/images/success.png" title="2019/12/18 14:34"></td><td class="centeralign" style="background-color:#FCC"> </td> </tr> <tr> <td class="rightalign"> <a href="//people.php.net/jasny">jasny</a> (jasny) </td> <td class="centeralign" style="background-color:#AFA"><img src="/lib/images/success.png" title="2019/12/20 05:21"></td><td class="centeralign" style="background-color:#FCC"> </td> </tr> <tr> <td class="rightalign"> <a href="//people.php.net/kalle">kalle</a> (kalle) </td> <td class="centeralign" style="background-color:#AFA"><img src="/lib/images/success.png" title="2019/12/18 11:43"></td><td class="centeralign" style="background-color:#FCC"> </td> </tr> <tr> <td class="rightalign"> <a href="//people.php.net/kocsismate">kocsismate</a> (kocsismate) </td> <td class="centeralign" style="background-color:#AFA"><img src="/lib/images/success.png" title="2019/12/18 10:47"></td><td class="centeralign" style="background-color:#FCC"> </td> </tr> <tr> <td class="rightalign"> <a href="//people.php.net/krakjoe">krakjoe</a> (krakjoe) </td> <td class="centeralign" style="background-color:#AFA"><img src="/lib/images/success.png" title="2019/12/18 11:09"></td><td class="centeralign" style="background-color:#FCC"> </td> </tr> <tr> <td class="rightalign"> <a href="//people.php.net/kriscraig">kriscraig</a> (kriscraig) </td> <td class="centeralign" style="background-color:#AFA"><img src="/lib/images/success.png" title="2019/12/18 10:29"></td><td class="centeralign" style="background-color:#FCC"> </td> </tr> <tr> <td class="rightalign"> <a href="//people.php.net/laruence">laruence</a> (laruence) </td> <td class="centeralign" style="background-color:#AFA"><img src="/lib/images/success.png" title="2019/12/20 05:41"></td><td class="centeralign" style="background-color:#FCC"> </td> </tr> <tr> <td class="rightalign"> <a href="//people.php.net/lcobucci">lcobucci</a> (lcobucci) </td> <td class="centeralign" style="background-color:#AFA"><img src="/lib/images/success.png" title="2019/12/18 11:12"></td><td class="centeralign" style="background-color:#FCC"> </td> </tr> <tr> <td class="rightalign"> <a href="//people.php.net/nikic">nikic</a> (nikic) </td> <td class="centeralign" style="background-color:#AFA"><img src="/lib/images/success.png" title="2019/12/18 08:44"></td><td class="centeralign" style="background-color:#FCC"> </td> </tr> <tr> <td class="rightalign"> <a href="//people.php.net/ocramius">ocramius</a> (ocramius) </td> <td class="centeralign" style="background-color:#AFA"><img src="/lib/images/success.png" title="2019/12/18 09:05"></td><td class="centeralign" style="background-color:#FCC"> </td> </tr> <tr> <td class="rightalign"> <a href="//people.php.net/pajoye">pajoye</a> (pajoye) </td> <td class="centeralign" style="background-color:#AFA"><img src="/lib/images/success.png" title="2019/12/18 10:37"></td><td class="centeralign" style="background-color:#FCC"> </td> </tr> <tr> <td class="rightalign"> <a href="//people.php.net/pierrick">pierrick</a> (pierrick) </td> <td class="centeralign" style="background-color:#AFA"><img src="/lib/images/success.png" title="2019/12/22 16:45"></td><td class="centeralign" style="background-color:#FCC"> </td> </tr> <tr> <td class="rightalign"> <a href="//people.php.net/reywob">reywob</a> (reywob) </td> <td class="centeralign" style="background-color:#AFA"><img src="/lib/images/success.png" title="2019/12/18 11:10"></td><td class="centeralign" style="background-color:#FCC"> </td> </tr> <tr> <td class="rightalign"> <a href="//people.php.net/salathe">salathe</a> (salathe) </td> <td class="centeralign" style="background-color:#AFA"><img src="/lib/images/success.png" title="2019/12/18 09:38"></td><td class="centeralign" style="background-color:#FCC"> </td> </tr> <tr> <td class="rightalign"> <a href="//people.php.net/santiagolizardo">santiagolizardo</a> (santiagolizardo) </td> <td class="centeralign" style="background-color:#AFA"><img src="/lib/images/success.png" title="2019/12/24 22:27"></td><td class="centeralign" style="background-color:#FCC"> </td> </tr> <tr> <td class="rightalign"> <a href="//people.php.net/sergey">sergey</a> (sergey) </td> <td class="centeralign" style="background-color:#AFA"><img src="/lib/images/success.png" title="2019/12/18 11:21"></td><td class="centeralign" style="background-color:#FCC"> </td> </tr> <tr> <td class="rightalign"> <a href="//people.php.net/toby">toby</a> (toby) </td> <td class="centeralign" style="background-color:#AFA"><img src="/lib/images/success.png" title="2019/12/19 10:52"></td><td class="centeralign" style="background-color:#FCC"> </td> </tr> <tr> <td class="rightalign"> <a href="//people.php.net/yunosh">yunosh</a> (yunosh) </td> <td class="centeralign" style="background-color:#AFA"><img src="/lib/images/success.png" title="2019/12/20 09:46"></td><td class="centeralign" style="background-color:#FCC"> </td> </tr> <!-- Results / sum per column --> <tr> <th class="rightalign"><b>Final result:</b></th> <th class="centeralign"><b>25</b></th> <th class="centeralign"><b>0</b></th> </tr> <tr> <td colspan="3"> This poll has been closed. </td> </tr> </tbody> </table> </form> </div> <h2 class="sectionedit6" id="differences_to_spl_object_id_and_weakreference">Differences to spl_object_id() and WeakReference</h2> <div class="level2"> <p> Weak maps require first-class language support and cannot be implemented using existing functionality provided by PHP. </p> <p> At first sight, it may seem that an array mapping from <code>spl_object_id()</code> to arbitrary values could serve the purpose of a weak map. This is not the case for multiple reasons: </p> <ul> <li class="level1"><div class="li"> <code>spl_object_id()</code> values are reused after the object is destroyed. Two different objects can have the same object ID -- just not at the same time.</div> </li> <li class="level1"><div class="li"> The object ID cannot be converted back into an object, so iteration over the map is not possible.</div> </li> <li class="level1"><div class="li"> The value stored under the ID will not be released when the object is destroyed.</div> </li> </ul> <p> Using the <code>WeakReference</code> class introduced in PHP 7.4, it is possible to avoid the first two issues, by using the following construction: </p> <div class="phpok"> <pre class="code php"><span class="co1">// Insertion</span> <span class="re0">$this</span><span class="sy0">-></span><span class="me1">map</span><span class="br0">[</span>spl_object_id<span class="br0">(</span><span class="re0">$object</span><span class="br0">)</span><span class="br0">]</span> <span class="sy0">=</span> <span class="br0">[</span>WeakReference<span class="sy0">::</span><span class="me2">create</span><span class="br0">(</span><span class="re0">$object</span><span class="br0">)</span><span class="sy0">,</span> <span class="re0">$data</span><span class="br0">]</span><span class="sy0">;</span> <span class="co1">// Lookup</span> <span class="re0">$id</span> <span class="sy0">=</span> spl_object_id<span class="br0">(</span><span class="re0">$object</span><span class="br0">)</span><span class="sy0">;</span> <span class="kw1">if</span> <span class="br0">(</span><a href="http://www.php.net/isset"><span class="kw3">isset</span></a><span class="br0">(</span><span class="re0">$this</span><span class="sy0">-></span><span class="me1">map</span><span class="br0">[</span><span class="re0">$id</span><span class="br0">]</span><span class="br0">)</span><span class="br0">)</span> <span class="br0">{</span> <span class="br0">[</span><span class="re0">$weakRef</span><span class="sy0">,</span> <span class="re0">$data</span><span class="br0">]</span> <span class="sy0">=</span> <span class="re0">$this</span><span class="sy0">-></span><span class="me1">map</span><span class="br0">[</span><span class="re0">$id</span><span class="br0">]</span><span class="sy0">;</span> <span class="kw1">if</span> <span class="br0">(</span><span class="re0">$weakRef</span><span class="sy0">-></span><span class="me1">get</span><span class="br0">(</span><span class="br0">)</span> <span class="sy0">===</span> <span class="re0">$object</span><span class="br0">)</span> <span class="br0">{</span> <span class="kw1">return</span> <span class="re0">$data</span><span class="sy0">;</span> <span class="br0">}</span> <span class="co1">// This entry belongs to a destroyed object.</span> <a href="http://www.php.net/unset"><span class="kw3">unset</span></a><span class="br0">(</span><span class="re0">$this</span><span class="sy0">-></span><span class="me1">map</span><span class="br0">[</span><span class="re0">$id</span><span class="br0">]</span><span class="br0">)</span><span class="sy0">;</span> <span class="br0">}</span> <span class="kw1">return</span> <span class="kw4">null</span><span class="sy0">;</span></pre></div> <p> This makes use of the <code>WeakReference</code> to determine whether the object ID has been reused. However, this does not solve the third problem: The data will not be released when the object is destroyed. It will only be released on the next access with an object that has the same reused ID, or if a garbage collection mechanism, which performs regular sweeps of the whole map, is implemented. </p> <p> A native weak map implementation will instead remove the value from the weak map as soon as the object key is destroyed. </p> </div> <!-- wikipage stop --> </div> <div class="docInfo"><bdi>rfc/weak_maps.txt</bdi> · Last modified: 2020/01/03 09:56 by <bdi>nikic</bdi></div> </div></div><!-- /content --> <hr class="a11y" /> <!-- PAGE ACTIONS --> <div id="dokuwiki__pagetools"> <h3 class="a11y">Page Tools</h3> <div class="tools"> <ul> <li><a href="/rfc/weak_maps?do=edit" class="action source" accesskey="v" rel="nofollow" title="Show pagesource [V]"><span>Show pagesource</span></a></li><li><a href="/rfc/weak_maps?do=revisions" class="action revs" accesskey="o" rel="nofollow" title="Old revisions [O]"><span>Old revisions</span></a></li><li><a href="/rfc/weak_maps?do=backlink" class="action backlink" rel="nofollow" title="Backlinks"><span>Backlinks</span></a></li><li><a href="#dokuwiki__top" class="action top" accesskey="t" rel="nofollow" title="Back to top [T]"><span>Back to top</span></a></li> </ul> </div> </div> </div><!-- /wrapper --> </div></div><!-- /site --> <div class="no"><img src="/lib/exe/taskrunner.php?id=rfc%3Aweak_maps&1732449715" width="2" height="1" alt="" /></div> <div id="screen__mode" class="no"></div> <!--[if ( lte IE 7 | IE 8 ) ]></div><![endif]--> </section> <section class="secondscreen"> <!-- TOC START --> <div id="dw__toc" class="dw__toc"> <h3 class="toggle">Table of Contents</h3> <div> <ul class="toc"> <li class="level1"><div class="li"><a href="#php_rfcweak_maps">PHP RFC: Weak maps</a></div> <ul class="toc"> <li class="level2"><div class="li"><a href="#introduction">Introduction</a></div></li> <li class="level2"><div class="li"><a href="#proposal">Proposal</a></div></li> <li class="level2"><div class="li"><a href="#backward_incompatible_changes">Backward Incompatible Changes</a></div></li> <li class="level2"><div class="li"><a href="#vote">Vote</a></div></li> <li class="level2"><div class="li"><a href="#differences_to_spl_object_id_and_weakreference">Differences to spl_object_id() and WeakReference</a></div></li> </ul></li> </ul> </div> </div> <!-- TOC END --> </section> </section><!-- .fullscreen --> <footer> <nav class="fullscreen"> <ul> <li><a href="//php.net/copyright">Copyright © 2001-2024 The PHP Group</a></li> <li><a href="//php.net/sites">Other PHP.net sites</a></li> <li><a href="//php.net/privacy">Privacy policy</a></li> </ul> </nav> </footer> </div><!-- .wrap --> </body> </html>