I\'m checking out some PHP 5.3.0
features and ran across some code on the site that looks quite funny:
public function getTotal($tax)
{
$tot
This is how PHP expresses a closure. This is not evil at all and in fact it is quite powerful and useful.
Basically what this means is that you are allowing the anonymous function to "capture" local variables (in this case, $tax
and a reference to $total
) outside of it scope and preserve their values (or in the case of $total
the reference to $total
itself) as state within the anonymous function itself.