Created
December 9, 2012 17:53
-
-
Save suin/4246280 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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