fork download
  1. <?php
  2.  
  3. class A1 {
  4. function __call($name, $arguments) {
  5. throw new \Exception('Method ..... ' . $name . ' not exists ...');
  6. }
  7.  
  8. /* When this method is public - it works good*/
  9. private function test($d) {
  10. var_dump($d);
  11. }
  12.  
  13. public function test1() {
  14. /* create anonym func, wherein the method is called test() */
  15. $rrr= function(){
  16. $this->test(1);
  17. };
  18. Closure::bind($rrr, $this);
  19. $rrr(); # catch Exception of __call() ...
  20. }
  21. }
  22.  
  23. $r = new A1;
  24. $r->test1();
  25.  
Success #stdin #stdout 0.02s 24448KB
stdin
Standard input is empty
stdout
int(1)