SwVitaliy

Untitled

Jul 24th, 2012
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.37 KB | None | 0 0
  1. <?php
  2.  
  3. class Example {
  4.   public $x = 4;
  5.   function printer () { echo "Hello World: $this->x!\n"; }
  6. }
  7.  
  8. $class = new ReflectionClass ('Example');
  9. $method = $class->getMethod ('printer');
  10.  
  11. $object = new Example;
  12. // $closure = $method->getClosure ($object);
  13. // $closure ();
  14. $method->invokeArgs($object, array());
  15. $object->x = 5;
  16. // $closure ();
  17. $method->invokeArgs($object, array());
Advertisement
Add Comment
Please, Sign In to add comment