3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(E_ALL); class A { protected $x; public function __construct( $x ) { $this->x = $x; } protected function f() { return $this->x; } public function m() { return A::f(); } } class B extends A { protected function f() { return 2 * $this->x; } } $a = new A(1); echo 'A: ' . $a->m() . PHP_EOL; $b = new B(1); echo 'B: ' . $b->m();

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
159.75 ms | 2591 KiB | 9 Q