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($this){
  16. $this->test(1);
  17. };
  18. $rrr(); # catch Exception of __call() ...
  19. }
  20. }
  21.  
  22. $r = new A1;
  23. $r->test1();
  24.  
Success #stdin #stdout #stderr 0.02s 24400KB
stdin
Standard input is empty
stdout
int(1)
stderr
PHP Warning:  Missing argument 1 for A1::{closure}(), called in /home/iSXPNQ/prog.php on line 18 and defined in /home/iSXPNQ/prog.php on line 15