Closures inside Objects
$this from current scope supported in Closures

<?php
class Foo {
  private 
$prop;
  function 
__construct($prop) {
    
$this->prop $prop;
  }
  public function 
getPrinter() {
    return function() { echo 
ucfirst($this->prop); };
  }
}

$a = new Foo('bar');;
$func $a->getPrinter();
$func(); // Outputs: Bar

You can also re-bind a closure to a new object instance

<?php
$a 
= new Foo('bar');
$b = new Foo('pickle');
$func $a->getPrinter();
$func(); // Outputs: Bar
$func $func->bindTo($b);
$func(); // Outputs: Pickle