3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { protected $foo = []; function add($name, $value, $priority = 500) { $this->foo[$name][$priority][] = $value; } public function get() { return $this->foo; } } $foo = new Foo; $foo->add('foo', 'a'); $foo->add('foo', 'a', 1000); $foo->add('foo', 'b'); $foo->add('foo', 'c', 0); var_dump($foo->get());
Output for git.master, git.master_jit, rfc.property-hooks
array(1) { ["foo"]=> array(3) { [500]=> array(2) { [0]=> string(1) "a" [1]=> string(1) "b" } [1000]=> array(1) { [0]=> string(1) "a" } [0]=> array(1) { [0]=> string(1) "c" } } }

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