function anonymes et closure en PHP.: fonction de callback
&lt;code&gt;echo preg_callback('~-([a-z])~', function ($match) {
    return strtoupper($match[1]);
}, 'bonjour-le-monde');&lt;/code&gt;
ou bien que la fonction anonyme capte une variable local en dehors de son &quot;scope&quot;(porté).
&lt;code&gt;
$callback = function ($quantity) use ($tax, &amp;$total) { .. };
print $calback
&lt;/code&gt;
- The closure is a function assigned to a variable, so you can pass it around
- A closure is a separate namespace, normally, you can not access variables defined outside of this namespace. 
There comes the use keyword:
-use allows you to access (use) the succeeding variables inside the closure.
-use is early binding. That means the variable values are COPIED upon defining the closure. So modifying $tax inside the closure has no external effect.
-You can pass in variables as pointers like in case of &amp;$total. This way, modifying the value of $total DOES HAVE an external effect, the original variable's value changes.