3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface intf{ public function setVar($a); public function getVar(); } class A implements intf{ private $A; public function setVar($a){ $this->A=$a; } public function getVar(){ return $this->A; } } class B extends Abs{ private $B; public function setVar($a){ $this->B=$a; } public function getVar(){ return $this->B; } } abstract class Abs{ abstract public function setVar($a); abstract public function getVar(); public function getDouble($a){ return $a*2; } } $A=new A(); $B=new B(); $A->setVar(2); echo ' Class A: '.$A->getVar(); $B->setVar(4); echo ' Class B: '.$B->getVar(); echo ' Class B Double: '.$B->getDouble($B->getVar()); echo ' Class A Double: '.$B->getDouble($A->getVar());
Output for git.master, git.master_jit, rfc.property-hooks
Class A: 2 Class B: 4 Class B Double: 8 Class A Double: 4

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.37 ms | 401 KiB | 8 Q