title: PHP 5.4 - 'closure $this support'
body: <p>I see that the new planned features for PHP 5.4 are: traits, array dereferencing, a JsonSerializable interface and something referred to as '<code>closure $this support</code>'</p>
  
  <p><a href="http://en.wikipedia.org/wiki/Php#Release_history" rel="noreferrer">http://en.wikipedia.org/wiki/Php#Release_history</a></p>
  
  <p>While the others are either immediately clear (JsonSerialiable, array dereferencing) or i looked up the specifics (traits), I am not sure what 'closure $this support' is.  I have been unsuccessful googling for it or finding anything about it on php.net</p>
  
  <p>Does anyone know what this is supposed to be?</p>
  
  <p>If i had to guess, it would mean something like this:</p>
  
  <pre><code>$a = 10; $b = 'strrrring';
  //'old' way, PHP 5.3.x
  $myClosure = function($x) use($a,$b)
               {
                   if (strlen($x) &lt;= $a) return $x;
                   else return $b;
               };
  
  //'new' way with closure $this for PHP 5.4
  $myNewClosure = function($x) use($a as $lengthCap,$b as $alternative)
                   {
                       if(strlen($x) &lt;=  $this-&gt;lengthCap)) return $x;
                       else 
                       {
                           $this-&gt;lengthCap++;  //lengthcap is incremented for next time around
                           return $this-&gt;alternative;
                       }
                   };
  </code></pre>
  
  <p>The significance (even if this example is trivial) being that in the past once the closure is constructed the bound 'use' variables are fixed.  With 'closure $this support' they are more like members you can mess with.</p>
  
  <p>Does this sound correct and/or close and/or reasonable?  Does anyone know what this 'closure $this support' means?</p>