3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A { private $name; function __construct($param){ $this->name = 'liming'.'<br>'; } function getName() { echo $this->name; } // 调用子类中的方法getAge2 function getAge() { $this->getAge2(); } function getAge3() { return '23'; } } class B extends A { function getAge2(){ echo $this->getAge3(); } } (new A('1'))->getAge();
based on CP9Op
Output for 7.0.0 - 7.3.0beta1
Fatal error: Uncaught Error: Call to undefined method A::getAge2() in /in/Wcl67:13 Stack trace: #0 /in/Wcl67(27): A->getAge() #1 {main} thrown in /in/Wcl67 on line 13
Process exited with code 255.
Output for hhvm-3.22.0
Fatal error: Uncaught Error: Call to undefined method A::getAge2() in /in/Wcl67:-1 Stack trace: #0 /in/Wcl67(-1): A->getAge() #1 {main}
Process exited with code 255.
Output for hhvm-3.18.5 - 3.21.3
Fatal error: Uncaught Error: Call to undefined method A::getAge2() in /in/Wcl67:13 Stack trace: #0 /in/Wcl67(27): A->getAge() #1 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.30
Fatal error: Call to undefined method A::getAge2() in /in/Wcl67 on line 13
Process exited with code 255.