How to call the current anonymous function in PHP?
<p>I have an anonymous function which is supposed to call itself. However, I have no variable or function name at hand, so I was hoping to find a function that could do return "this" in context of functions. Is there such a thing?</p>

<p>Here's an example:</p>

<pre><code>$f = function() use($bar, $foo) {
  // call this function again.
};
</code></pre>

<p>Calling like this:</p>

<pre><code>call_user_func(__FUNCTION__);
</code></pre>

<p>Leads to this:</p>

<blockquote>
  <p>Warning: call_user_func() expects parameter 1 to be a valid callback,
  function '{closure}' not found or invalid function name</p>
</blockquote>

<p>If I try to put $f in the use-list, then it says the variable is not defined (because it is not yet).</p>
