fork download
  1. <?php
  2.  
  3. $closure = function() {
  4. echo $this->foo;
  5. };
  6.  
  7. $context = new \StdClass;
  8. $context->foo = "Hello World";
  9.  
  10. $boundClosure = $closure->bindTo($context);
  11. $boundClosure();
Success #stdin #stdout 0s 82880KB
stdin
Standard input is empty
stdout
Hello World