Skip to content

Instantly share code, notes, and snippets.

@yields
Created August 16, 2012 11:01
Show Gist options
  • Save yields/3369296 to your computer and use it in GitHub Desktop.
Save yields/3369296 to your computer and use it in GitHub Desktop.
<?php
class Context {
var $foo = 'Hello, World';
}
class Func {
function fn (callable $fn) {
$fn = $fn->bindto(new Context);
$fn();
}
}
$fn = new Func;
$fn->fn(function () {
echo $this->foo;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment