Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- 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 ();
- $method->invokeArgs($object, array());
- $object->x = 5;
- // $closure ();
- $method->invokeArgs($object, array());
Advertisement
Add Comment
Please, Sign In to add comment