3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class Cache{ protected function put($key,$value){ static $cache = []; var_dump($cache); return $cache[$key] = $value; } } $instance1 = new class extends Cache{ public function store($key,$value) { return $this->put($key,$value); } }; $instance1->store("one",1); $instance1->store("two",2); $instance1->store("three",3); $instance2 = new class extends Cache{ public function store($key,$value) { return $this->put($key,$value); } }; $instance2->store("four",4); $instance2->store("five",5); $instance3 = new class extends Cache{ public function store($key,$value) { return $this->put($key,$value); } }; $instance3->store("six",6); $instance3->store("seven",7);
Output for git.master, git.master_jit, rfc.property-hooks
array(0) { } array(1) { ["one"]=> int(1) } array(2) { ["one"]=> int(1) ["two"]=> int(2) } array(3) { ["one"]=> int(1) ["two"]=> int(2) ["three"]=> int(3) } array(4) { ["one"]=> int(1) ["two"]=> int(2) ["three"]=> int(3) ["four"]=> int(4) } array(5) { ["one"]=> int(1) ["two"]=> int(2) ["three"]=> int(3) ["four"]=> int(4) ["five"]=> int(5) } array(6) { ["one"]=> int(1) ["two"]=> int(2) ["three"]=> int(3) ["four"]=> int(4) ["five"]=> int(5) ["six"]=> int(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:
69.87 ms | 407 KiB | 5 Q