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 { array_splice($this->arr, $index, 1); if ($index === 0) { throw new Exception("Cannot remove the first element of an array, reason: https://www.youtube.com/watch?v=bvlSQz7cBr0"); } } 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()); $obj->removeElementFromArr(0);

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.4.120.0140.00720.65
8.4.110.0120.00718.85
8.4.100.0140.00518.73
8.4.90.0100.01020.48
8.4.80.0050.00318.93
8.4.70.0110.00618.13
8.4.60.0100.00618.97
8.4.50.0130.00718.96
8.4.40.0130.00717.88
8.4.30.0060.00618.82
8.4.20.0040.00418.15
8.4.10.0060.01019.49
8.3.250.0160.00718.68
8.3.240.0060.01418.46
8.3.230.0100.01016.87
8.3.220.0130.00618.77
8.3.210.0080.00816.94
8.3.200.0070.00216.54
8.3.190.0110.00717.29
8.3.180.0040.00516.60
8.3.170.0110.00720.64
8.3.160.0120.00618.29
8.3.150.0090.00916.94
8.3.140.0070.00718.61
8.3.130.0040.00418.66
8.3.120.0150.00020.47
8.3.110.0090.00020.94
8.3.100.0030.00624.06
8.3.90.0050.00326.77
8.3.80.0030.00618.43
8.3.70.0160.00318.55
8.3.60.0120.00918.56
8.3.50.0090.00616.64
8.3.40.0090.00620.34
8.3.30.0140.00320.34
8.3.20.0050.00224.18
8.3.10.0000.00824.66
8.3.00.0120.00928.09
8.2.290.0110.00720.54
8.2.280.0050.00418.54
8.2.270.0030.00617.51
8.2.260.0130.00716.67
8.2.250.0030.00518.41
8.2.240.0040.01119.05
8.2.230.0050.00322.58
8.2.220.0050.00537.54
8.2.210.0000.00826.77
8.2.200.0030.00616.63
8.2.190.0150.00016.74
8.2.180.0150.00616.88
8.2.170.0090.00919.08
8.2.160.0070.00722.96
8.2.150.0040.00425.66
8.2.140.0000.00824.66
8.2.130.0150.00428.09
8.2.120.0160.00328.09
8.2.110.0080.01128.09
8.2.100.0090.00928.09
8.2.90.0120.00328.09
8.2.80.0090.00028.09
8.2.70.0060.00328.09
8.2.60.0040.00428.09
8.2.50.0000.00828.09
8.2.40.0040.00428.09
8.2.30.0080.00028.09
8.2.20.0080.00028.09
8.2.10.0000.00828.09
8.2.00.0000.00828.09
8.1.330.0070.00216.44
8.1.320.0100.00916.14
8.1.310.0030.00516.42
8.1.300.0060.00318.28
8.1.290.0090.00030.84
8.1.280.0150.00925.92
8.1.270.0060.00322.00
8.1.260.0040.00428.09
8.1.250.0090.00028.09
8.1.240.0080.00028.09
8.1.230.0000.00828.09
8.1.220.0040.00428.09
8.1.210.0040.00428.09
8.1.200.0040.00428.09
8.1.190.0030.00728.09
8.1.180.0080.00028.09
8.1.170.0050.00328.09
8.1.160.0080.00028.09
8.1.150.0060.00328.09
8.1.140.0060.00328.09
8.1.130.0100.00028.09
8.1.120.0000.00928.09
8.1.110.0040.00428.09
8.1.100.0040.00428.09
8.1.90.0000.00928.09
8.1.80.0080.00028.09
8.1.70.0030.00628.09
8.1.60.0060.00328.09
8.1.50.0060.00328.09
8.1.40.0050.00528.09
8.1.30.0080.00028.09
8.1.20.0080.00028.09
8.1.10.0040.00428.09
8.1.00.0050.00328.09

preferences:
29.47 ms | 403 KiB | 5 Q