3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { private $items = ['a','b','c','d']; public function dup() { $dupes = 0; foreach ($this->items as $key => $item) { $this->addItem($item . '2', $key + 1 + $dupes); $dupes++; } } private function addItem($newItem, $position) { array_splice($this->items, $position, 0, array($newItem)); } public function dump() { var_dump($this->items); } } $test = new Test(); $test->dup(); $test->dump();
Output for git.master, git.master_jit, rfc.property-hooks
array(8) { [0]=> string(1) "a" [1]=> string(2) "a2" [2]=> string(1) "b" [3]=> string(2) "b2" [4]=> string(1) "c" [5]=> string(2) "c2" [6]=> string(1) "d" [7]=> string(2) "d2" }

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:
133.59 ms | 406 KiB | 5 Q