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();

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.00622.27
8.4.110.0110.00922.40
8.4.100.0090.01118.97
8.4.90.0120.00920.53
8.4.80.0110.00918.83
8.4.70.0150.01018.91
8.4.60.0110.00918.82
8.4.50.0070.00218.75
8.4.40.0130.00717.99
8.4.30.0030.01020.41
8.4.20.0040.00817.71
8.4.10.0030.00619.45
8.3.250.0110.00818.79
8.3.240.0110.00616.69
8.3.230.0140.00416.64
8.3.220.0090.00618.87
8.3.210.0130.00516.67
8.3.200.0050.00416.56
8.3.190.0130.00617.41
8.3.180.0080.00618.88
8.3.170.0160.00316.36
8.3.160.0040.01217.20
8.3.150.0150.00317.12
8.3.140.0130.00618.96
8.3.130.0060.01218.34
8.3.120.0090.00018.83
8.3.110.0030.00616.41
8.3.100.0030.00720.36
8.3.90.0000.00926.77
8.3.80.0060.00319.36
8.3.70.0120.00318.18
8.3.60.0150.00018.34
8.3.50.0230.01224.38
8.3.40.0070.01418.93
8.3.30.0060.00918.71
8.3.20.0000.00724.18
8.3.10.0040.00424.66
8.3.00.0040.00426.16
8.2.290.0040.00420.54
8.2.280.0040.00418.89
8.2.270.0040.01516.60
8.2.260.0040.01116.42
8.2.250.0040.00418.53
8.2.240.0090.00618.39
8.2.230.0030.00620.94
8.2.220.0090.00024.06
8.2.210.0000.00826.77
8.2.200.0040.00718.88
8.2.190.0060.01318.29
8.2.180.0090.01225.92
8.2.170.0070.00718.84
8.2.160.0070.00722.96
8.2.150.0040.00425.66
8.2.140.0040.00424.66
8.2.130.0000.00826.16
8.2.120.0040.00421.04
8.2.110.0060.00322.07
8.2.100.0060.00617.78
8.2.90.0000.00819.27
8.2.80.0040.00417.97
8.2.70.0030.00617.50
8.2.60.0000.00817.63
8.2.50.0040.00417.80
8.2.40.0050.00517.93
8.2.30.0000.00718.11
8.2.20.0000.00718.04
8.2.10.0040.00419.34
8.2.00.0080.00019.29
8.1.330.0110.00817.85
8.1.320.0120.00715.94
8.1.310.0120.00316.13
8.1.300.0030.00718.49
8.1.290.0070.00430.84
8.1.280.0120.00625.92
8.1.270.0080.00022.11
8.1.260.0100.00326.35
8.1.250.0040.00428.09
8.1.240.0060.00320.96
8.1.230.0060.00619.54
8.1.220.0000.00817.74
8.1.210.0080.00018.77
8.1.200.0060.00317.35
8.1.190.0000.00817.23
8.1.180.0040.00418.10
8.1.170.0080.00017.62
8.1.160.0000.00718.79
8.1.150.0030.00318.77
8.1.140.0000.00720.72
8.1.130.0000.00820.15
8.1.120.0040.00417.42
8.1.110.0000.00817.45
8.1.100.0030.00517.48
8.1.90.0050.00317.43
8.1.80.0040.00417.41
8.1.70.0000.00717.34
8.1.60.0050.00517.56
8.1.50.0000.00817.58
8.1.40.0070.00017.42
8.1.30.0040.00417.49
8.1.20.0060.00317.57
8.1.10.0060.00617.59
8.1.00.0080.00017.56
8.0.300.0040.00418.77
8.0.290.0040.00416.75
8.0.280.0030.00618.46
8.0.270.0040.00418.07
8.0.260.0000.00618.41
8.0.250.0000.00716.86
8.0.240.0000.00716.96
8.0.230.0000.00716.85
8.0.220.0070.00016.89
8.0.210.0030.00516.78
8.0.200.0000.00716.95
8.0.190.0000.00716.87
8.0.180.0000.00716.91
8.0.170.0030.00616.88
8.0.160.0040.00416.97
8.0.150.0040.00416.85
8.0.140.0030.00316.87
8.0.130.0030.00313.41
8.0.120.0030.00516.73
8.0.110.0000.00716.89
8.0.100.0000.00716.93
8.0.90.0030.00316.77
8.0.80.0050.01416.86
8.0.70.0020.00516.68
8.0.60.0080.00016.79
8.0.50.0040.00416.91
8.0.30.0030.01316.81
8.0.20.0210.00016.74
8.0.10.0130.00817.23
8.0.00.0150.00817.09
7.4.330.0000.00515.55
7.4.320.0000.00616.55
7.4.300.0030.00316.41
7.4.290.0040.00416.55
7.4.280.0000.00716.56
7.4.270.0030.00316.64
7.4.260.0000.00513.30
7.4.250.0000.00816.58
7.4.240.0040.00416.67
7.4.230.0000.00716.62
7.4.220.0040.00316.52
7.4.210.0070.00916.60
7.4.200.0040.00416.41
7.4.150.0140.00716.49
7.4.140.0100.01316.59
7.4.130.0150.00516.22
7.4.120.0150.00916.35
7.4.110.0200.00316.33
7.4.100.0040.02116.59
7.4.90.0190.00516.55
7.4.80.0180.00716.52
7.4.70.0170.00716.44
7.4.60.0210.00616.36
7.4.50.0210.00416.53
7.4.40.0140.01016.33
7.4.30.0200.01016.55
7.4.20.0150.00916.45
7.4.10.0090.01316.26
7.4.00.0140.01416.63
7.3.330.0000.00716.29
7.3.320.0000.00513.26
7.3.310.0000.00716.29
7.3.300.0050.00216.12
7.3.290.0050.00916.30
7.3.270.0120.00916.51
7.3.260.0130.01016.29
7.3.250.0030.01716.57
7.3.240.0060.01416.33
7.3.230.0150.01016.27
7.3.220.0160.00716.47
7.3.210.0170.00616.45
7.3.200.0110.01116.50
7.3.190.0200.00716.25
7.3.180.0110.01716.23
7.3.170.0220.00516.49
7.3.160.0190.01016.49
7.3.150.0130.01016.50
7.3.140.0160.00616.27
7.3.130.0210.01116.28
7.3.120.0110.01616.32
7.3.110.0210.00616.34
7.3.100.0220.00416.49
7.3.90.0190.00316.27
7.3.80.0140.01116.34
7.3.70.0150.00716.35
7.3.60.0120.01216.38
7.3.50.0170.01016.38
7.3.40.0030.01916.39
7.3.30.0140.01416.24
7.3.20.0220.00416.60
7.3.10.0070.01516.39
7.3.00.0130.01016.46

preferences:
30.96 ms | 403 KiB | 5 Q