Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class foo {
- public function getClosure() {
- return function() {
- echo $this->hello;
- $this->world();
- };
- }
- }
- class bar {
- public $hello = "Hello ";
- private function world() { echo "World"; }
- }
- $foo = new Foo();
- $closure - $foo->getClosure();
- $bar = new Bar();
- $newClosure = $closure->bindTo($bar);
- $newClosure();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement