3v4l.org

run code in 300+ PHP versions simultaneously
<?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(); } } $a = new B('a'); $a->getName(); $a->getAge(); $b = new A('b'); $b->getAge();

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
161.42 ms | 3389 KiB | 8 Q