3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Base { private int $pv = 0; protected int $pt = 0; public int $pb = 0; public function setBase(int $i) { $this->pv = $i; $this->pt = $i; $this->pb = $i; } public function dump() { echo "private(base):$this->pv; protected(base):$this->pt; public(base):$this->pb\n"; } }; class Derived extends Base { private int $pv = 0; protected int $pt = 0; public int $pb = 0; public function setDerived(int $i) { $this->pv = $i; $this->pt = $i; $this->pb = $i; } public function dump() { parent::dump(); echo "private(derived):$this->pv; protected(derived):$this->pt; public(derived):$this->pb\n"; } }; $o = new Derived; $o->setBase(2); $o->dump(); $o->setDerived(6); $o->dump();
Output for git.master_jit, git.master
private(base):2; protected(base):2; public(base):2 private(derived):0; protected(derived):2; public(derived):2 private(base):2; protected(base):6; public(base):6 private(derived):6; protected(derived):6; public(derived):6

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:
57.21 ms | 405 KiB | 5 Q