Closures in PHP

Ein Beispiel für den Einsatz von Closures in PHP 5.3.

class MyExample2 {
 function setup() {}
 function teardown() {}
 function doit($operation) {
 $this->setup();
 $operation();
 $this->teardown();
 }
}
$myObject = new MyExample2();
$myObject->doIt(function () {   });
// ...
$myObject->doIt(function () {   });

Possibly related posts (automatically generated)