Wrap text
Report abuse
|
|
class Example {
public $x = 4;
function printer () { echo "Hello World: $this->x!\n"; }
}
$class = new ReflectionClass ('Example');
$method = $class->getMethod ('printer');
$object = new Example;
$closure = $method->getClosure ($object);
$closure ();
$object->x = 5;
$closure ();
|