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();
Output for rfc.property-hooks, git.master, git.master_jit
A: 1 B: 1

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
50.98 ms | 1984 KiB | 4 Q