Parent::function does not run magic __call - PHP Online

Form of PHP Sandbox

Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php in the places where the PHP script should be executed.

Name: Parent::function does not run magic __call fullscreencopydownloadembedprint


Your result can be seen below.

Result of php executing





Full code of Parent::function does not run magic __call.php

  1. <?php
  2.  
  3. class A {
  4.     
  5.     public function tearDown()
  6.     {
  7.         var_dump('a');
  8.     }
  9. }
  10.  
  11. class B extends A {
  12.     
  13.     public function __call($name, $arguments)
  14.     {
  15.         var_dump($name);
  16.     }
  17. }
  18.  
  19. class C extends B {
  20.     
  21.     public function tearDown()
  22.     {
  23.         var_dump('c');
  24.         parent::tearDown();
  25.     }
  26. }
  27.  
  28. $c = new C();
  29. $c->tearDown();
File Description
  • Parent::function does not run magic __call
  • PHP Code
  • 07 Feb-2019
  • 353 Bytes
You can Share it: