3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private $consumer; public function getConsumer() { var_dump(__METHOD__); return $this->consumer; } public function setConsumer($val) { $this->consumer = $val; } } class B extends A { protected $consumer; public function __construct($val) { $this->consumer = $val; } public function test() { var_dump(__METHOD__); return $this->consumer; } } var_dump("Construct B with 'B'"); $b = new B("B"); var_dump($b->test()); var_dump($b->getConsumer()); var_dump("B::setConsumer('A')"); $b->setConsumer("A"); var_dump($b->getConsumer()); var_dump($b->test());
Output for git.master, git.master_jit, rfc.property-hooks
string(20) "Construct B with 'B'" string(7) "B::test" string(1) "B" string(14) "A::getConsumer" NULL string(19) "B::setConsumer('A')" string(14) "A::getConsumer" string(1) "A" string(7) "B::test" string(1) "B"

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:
39.33 ms | 401 KiB | 8 Q