Here's my solution to writing an accumulator generator in PHP, listed here because Paul Graham is no longer accepting submissions:
function foo($n) {
$nname = uniqid(rand(), true);
$GLOBALS[$nname] = $n;
return create_function('$i',
'return $GLOBALS["' . $nname .'"] += $i;');
}
Slightly hacky (*ahem*), but I like the fact you can do tricks like this in PHP when you have to -- in fact something very similar to this comes in useful in my Flatfile package when I need to turn an instance method of an object into a function for use with built-in sorting methods.