3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Based { private array $arr = ["zero", "one", "two", "three", "four", "five"]; public function removeElementFromArr (int $index): void { $tmp = $this->getArr(); array_splice($tmp, $index, 1); $this->setArr($tmp); } public function getArr (): array { return $this->arr; } public function setArr (array $newArr) { $this->arr = $newArr; } } $obj = new Based(); var_dump($obj->getArr()); $obj->removeElementFromArr(3); var_dump($obj->getArr());
Output for git.master_jit, git.master, rfc.property-hooks
array(6) { [0]=> string(4) "zero" [1]=> string(3) "one" [2]=> string(3) "two" [3]=> string(5) "three" [4]=> string(4) "four" [5]=> string(4) "five" } array(5) { [0]=> string(4) "zero" [1]=> string(3) "one" [2]=> string(3) "two" [3]=> string(4) "four" [4]=> string(4) "five" }

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