3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Record { protected $index=0; //page index protected $pages=[]; //pages array public function nextPage() { $this->index++; } public function addRecord($key, $value) { $this->pages[$this->index][$key] = $value; } public function getPage($index) { if ($index > $this->index) return NULL; else return $this->pages[$this->index]; } } class AdditiveRecord extends Record { public function getSums($range) { $sums = $this->pages[$range[0]]; $lim = ($range[1] <= $this->index) ? $range[1] : $this->index; echo $lim; echo $index; for ($i = $range[0]+1;$i<=$lim;$i++) { foreach($this->pages[$i] as $k=>$v) $sums[$k] += $v; } return $sums; } } $m = new AdditiveRecord(); for ($j = 1;$j<3;$j++) { for ($i = 1;$i<10;$i++) $m->addRecord($i,$j*10+$i); $m->nextPage(); } var_dump($m->getSums([0,2]));

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.3.60.0110.00318.55
8.3.50.0130.00616.35
8.3.40.0110.00718.82
8.3.30.0120.00318.75
8.3.20.0040.00420.20
8.3.10.0000.00821.78
8.3.00.0040.00419.81
8.2.180.0040.01117.00
8.2.170.0090.00922.96
8.2.160.0100.01020.39
8.2.150.0080.00024.18
8.2.140.0160.00324.66
8.2.130.0050.00226.16
8.2.120.0030.01017.38
8.2.110.0070.00319.10
8.2.100.0060.00617.91
8.2.90.0050.00317.88
8.2.80.0080.00018.75
8.2.70.0030.00618.05
8.2.60.0080.00017.93
8.2.50.0060.00618.10
8.2.40.0050.00220.64
8.2.30.0030.00719.91
8.2.20.0060.00317.79
8.2.10.0000.00718.01
8.2.00.0040.00418.19
8.1.280.0110.00625.92
8.1.270.0090.00920.23
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0030.00917.48
8.1.230.0040.00717.70
8.1.220.0040.00417.91
8.1.210.0030.00618.77
8.1.200.0000.00917.48
8.1.190.0030.00617.36
8.1.180.0040.00418.10
8.1.170.0000.00818.78
8.1.160.0000.00722.14
8.1.150.0000.00718.93
8.1.140.0040.00417.33
8.1.130.0000.00817.70
8.1.120.0040.00417.44
8.1.110.0000.00817.34
8.1.100.0080.00017.37
8.1.90.0030.00517.48
8.1.80.0020.00517.29
8.1.70.0030.00517.49
8.1.60.0060.00317.64
8.1.50.0050.00417.38
8.1.40.0000.00817.42
8.1.30.0030.00617.62
8.1.20.0000.00917.57
8.1.10.0040.00417.45
8.1.00.0050.00317.49
8.0.300.0000.00918.77
8.0.290.0060.00316.75
8.0.280.0040.00418.52
8.0.270.0000.00717.17
8.0.260.0030.00317.17
8.0.250.0070.00017.07
8.0.240.0070.00016.92
8.0.230.0000.00716.96
8.0.220.0000.00717.00
8.0.210.0030.00516.98
8.0.200.0060.00016.95
8.0.190.0030.00516.96
8.0.180.0070.00016.92
8.0.170.0050.00316.84
8.0.160.0000.00717.04
8.0.150.0050.00216.94
8.0.140.0000.00716.93
8.0.130.0040.00413.41
8.0.120.0040.00416.98
8.0.110.0000.00816.80
8.0.100.0070.00016.89
8.0.90.0050.00316.83
8.0.80.0030.01317.00
8.0.70.0040.00416.95
8.0.60.0000.00816.91
8.0.50.0040.00416.99
8.0.30.0050.01217.20
8.0.20.0120.00717.40
8.0.10.0000.00716.96
8.0.00.0100.01016.72
7.4.330.0050.00015.08
7.4.320.0030.00316.63
7.4.300.0000.00616.62
7.4.290.0030.00316.48
7.4.280.0040.00416.65
7.4.270.0030.00316.62
7.4.260.0030.00316.43
7.4.250.0040.00416.48
7.4.240.0030.00616.51
7.4.230.0000.00716.59
7.4.220.0130.01316.42
7.4.210.0030.01216.68
7.4.200.0000.00716.70
7.4.160.0040.01216.30
7.4.150.0130.00617.40
7.4.140.0150.00717.86
7.4.130.0090.00916.46
7.4.120.0090.00916.64
7.4.110.0060.01316.42
7.4.100.0090.01616.52
7.4.90.0090.00916.61
7.4.80.0070.01719.39
7.4.70.0100.00716.55
7.4.60.0040.01316.54
7.4.50.0040.00416.68
7.4.40.0070.01116.72
7.4.30.0100.01016.56
7.4.00.0110.00715.19
7.3.330.0000.00613.30
7.3.320.0050.00013.45
7.3.310.0000.00716.49
7.3.300.0040.00416.32
7.3.290.0170.00716.44
7.3.280.0110.00716.39
7.3.270.0140.00717.40
7.3.260.0160.00716.46
7.3.250.0090.00916.56
7.3.240.0080.01416.65
7.3.230.0060.01216.39
7.3.210.0130.00616.49
7.3.200.0100.00719.39
7.3.190.0100.00616.54
7.3.180.0110.00616.47
7.3.170.0090.00916.37
7.3.160.0060.01116.54
7.3.10.0080.00416.92
7.3.00.0030.00716.81
7.2.330.0120.00616.69
7.2.320.0030.01616.83
7.2.310.0030.01316.59
7.2.300.0120.00516.73
7.2.290.0100.00716.52
7.2.130.0000.01417.04
7.2.120.0060.00317.05
7.2.110.0000.01616.92
7.2.100.0030.00916.92
7.2.90.0100.00616.81
7.2.80.0000.01016.64
7.2.70.0000.01217.03
7.2.60.0030.00917.09
7.2.50.0000.01417.05
7.2.40.0060.00917.14
7.2.30.0040.00817.05
7.2.20.0070.00717.03
7.2.10.0090.00617.20
7.2.00.0060.00518.33
7.1.250.0070.00715.57
7.1.100.0060.00618.05
7.1.70.0030.00617.09
7.1.60.0100.01620.03
7.1.50.0270.01034.73
7.1.00.0000.08022.40
7.0.200.0130.00016.78
7.0.60.0230.06319.80
7.0.50.0070.03717.86
7.0.40.0100.08020.25
7.0.30.0630.06320.09
7.0.20.0230.07320.31
7.0.10.0070.08020.07
7.0.00.0100.08320.12
5.6.280.0030.03021.09
5.6.210.0030.04020.63
5.6.200.0000.04318.15
5.6.190.0100.05320.50
5.6.180.3500.04020.48
5.6.170.0200.07320.47
5.6.160.0030.05720.44
5.6.150.0070.06018.25
5.6.140.0070.05718.23
5.6.130.0070.05018.18
5.6.120.0100.04321.15
5.6.110.0130.07721.02
5.6.100.0000.08021.00
5.6.90.0070.09021.01
5.6.80.0100.08320.49
5.6.70.4300.04320.50
5.5.350.4130.03720.42
5.5.340.0170.07017.98
5.5.330.0030.04320.13
5.5.320.3730.04320.36
5.5.310.0330.08020.27
5.5.300.0000.04718.07
5.5.290.0070.06317.98
5.5.280.0200.07020.66
5.5.270.0100.08020.82
5.5.260.0070.09020.80
5.5.250.0100.08020.60
5.5.240.0230.07320.16
5.4.450.0570.06319.55
5.4.440.0670.05319.30
5.4.430.0530.05719.44
5.4.420.0600.05719.32
5.4.410.0530.05719.21
5.4.400.0470.05718.85
5.4.390.0770.03018.77
5.4.380.0600.05319.12
5.4.370.0600.05319.29
5.4.360.0600.06019.30
5.4.350.0600.05719.01
5.4.340.0600.05319.35
5.4.320.0570.06719.12
5.4.310.0830.06019.30
5.4.300.0730.05719.14
5.4.290.0530.05719.28
5.4.280.0600.05319.13
5.4.270.0630.04719.11
5.4.260.0700.04019.13
5.4.250.0570.05718.86
5.4.240.0530.05719.14
5.4.230.0670.04719.15
5.4.220.0100.05318.83
5.4.210.0130.04719.01
5.4.200.0000.05716.97
5.4.190.0530.05719.34
5.4.180.0530.04718.88
5.4.170.0430.05719.16
5.4.160.0470.05319.26
5.4.150.0670.05019.21
5.4.140.0700.05016.46
5.4.130.0830.04716.38
5.4.120.0700.05016.39
5.4.110.0730.06316.77
5.4.100.0600.06316.45
5.4.90.0130.06016.37
5.4.80.0100.05716.38
5.4.70.0130.05316.34
5.4.60.0630.03716.49
5.4.50.0670.04716.40
5.4.40.0570.05316.29
5.4.30.0600.04716.29
5.4.20.0770.05316.41
5.4.10.0570.05016.39
5.4.00.0730.04015.96

preferences:
43.55 ms | 400 KiB | 5 Q