Skip to content

Instantly share code, notes, and snippets.

@suin
Created December 9, 2012 17:53
Show Gist options
  • Save suin/4246280 to your computer and use it in GitHub Desktop.
Save suin/4246280 to your computer and use it in GitHub Desktop.
<?php
class Foo
{
private $foo = 'bar';
public function generate()
{
return function() {
return $this->foo;
};
}
}
$closure = call_user_func(function(){
$foo = new Foo();
return $foo->generate();
});
var_dump($closure());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment