Bubble Foundry


Posts tagged with: anonymous functions

PHP Closures
PHP 5.3 has added support for true anonymous functions and closures. Unfortunately, there are a few gotchas. The main one is that no variables are automatically enclosed: you must specify the variables you want to enclose. So, this will cause an exception: $a = 2; $f = function($i) { return $i + $a; } $f(1); […] Read more – ‘PHP Closures’.