View Single Post
  #2  
Old 12-12-2009, 12:52 AM
WhiteDragon WhiteDragon is offline
Banned
Join Date: Feb 2007
Posts: 1,002
WhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to beholdWhiteDragon is a splendid one to behold
Another cool thing would be binding variables to the closure during creation:
PHP Code:
function foo() {
  
temp.a = 2;
  
temp.f = function (temp.x, temp.y) use (temp.a) {
    return (
temp.x + temp.y) * temp.a;
  };
  
this.bar(temp.f, 3);
}

function 
bar(temp.c, temp.d) {
  echo(
temp.c(4, temp.d)); // would echo 14
} 
Reply With Quote