3v4l.org

run code in 300+ PHP versions simultaneously
<?php $classmap1 = array(); for ($i=1; $i<=10000; $i++) { $classmap1['a'.$i] = $i+1; } $classmap2 = array(); for ($i=1; $i<=10000; $i++) { $classmap2['b'.$i] = $i+1; } $startTimeMerge = microtime(true); $map = array_merge($classmap1, $classmap2); $endTimeMerge = microtime(true); $startTimeForeach = microtime(true); foreach ($classmap2 as $k => $v) { $classmap1[$k] = $v; } $endTimeForeach = microtime(true); function amerge(array &$a, array &$b) { foreach ($b as $key => $value) { $a[$key] = $value; } return $a; } $startTimeFunc = microtime(true); amerge($classmap1, $classmap2); $endTimeFunc = microtime(true); echo "Merging took " . (($endTimeMerge - $startTimeMerge)*1000) ." microseconds<br />\n"; echo "Foreach took " . (($endTimeForeach - $startTimeForeach)*1000) ." microseconds<br />\n"; echo "Func took " . (($endTimeFunc - $startTimeFunc)*1000) ." microseconds<br />\n";

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)
7.4.00.0070.02018.60
7.3.120.0110.01418.88
7.3.110.0130.01318.50
7.3.100.0000.01718.80
7.3.90.0030.01718.53
7.3.80.0070.01418.66
7.3.70.0110.01118.53
7.3.60.0000.01518.55
7.3.50.0030.01618.54
7.3.40.0110.00718.36
7.3.30.0100.01018.77
7.3.20.0030.01722.80
7.3.10.0070.01322.36
7.3.00.0120.00922.43
7.2.250.0100.01718.79
7.2.240.0100.01618.05
7.2.230.0060.01618.03
7.2.220.0070.01618.65
7.2.210.0000.02118.49
7.2.200.0160.00618.30
7.2.190.0070.01718.47
7.2.180.0030.01618.52
7.2.170.0030.01618.48
7.2.160.0070.01418.23
7.2.150.0070.01320.63
7.2.140.0030.01620.63
7.2.130.0070.01720.89
7.2.120.0090.01220.56
7.2.110.0030.01720.82
7.2.100.0030.01320.59
7.2.90.0030.01220.66
7.2.80.0060.01220.63
7.2.70.0070.01020.98
7.2.60.0110.00420.93
7.2.50.0030.01720.70
7.2.40.0060.01320.68
7.2.30.0100.01320.67
7.2.20.0060.01620.65
7.2.10.0070.01020.57
7.2.00.0050.01621.98
7.1.330.0070.01619.79
7.1.320.0080.01519.80
7.1.310.0000.01819.80
7.1.300.0060.01519.54
7.1.290.0100.01319.85
7.1.280.0060.01519.80
7.1.270.0000.01819.79
7.1.260.0070.01419.58
7.1.250.0070.01719.79
7.1.240.0060.00919.62
7.1.230.0040.01819.58
7.1.220.0120.00819.80
7.1.210.0030.01419.82
7.1.200.0130.00719.82
7.1.190.0070.01419.40
7.1.180.0130.01019.70
7.1.170.0100.01019.72
7.1.160.0090.00919.81
7.1.150.0030.01219.76
7.1.140.0030.01319.45
7.1.130.0110.00619.80
7.1.120.0070.01119.83
7.1.110.0000.02019.77
7.1.100.0000.02119.82
7.1.90.0060.01519.78
7.1.80.0070.01319.82
7.1.70.0080.00920.42
7.1.60.0110.01620.49
7.1.50.0080.01120.21
7.1.40.0080.01119.60
7.1.30.0060.00919.63
7.1.20.0030.02019.56
7.1.10.0100.01419.68
7.1.00.0070.04522.91
7.0.330.0000.02119.52
7.0.320.0060.01619.07
7.0.310.0080.01119.37
7.0.300.0070.01419.24
7.0.290.0060.01619.38
7.0.280.0120.00918.98
7.0.270.0000.01919.55
7.0.260.0030.01919.13
7.0.250.0070.01019.48
7.0.240.0090.00919.37
7.0.230.0060.01619.30
7.0.220.0040.01619.34
7.0.210.0030.01419.62
7.0.200.0060.01420.01
7.0.190.0090.01219.46
7.0.180.0140.00719.44
7.0.170.0100.00319.30
7.0.160.0060.01519.13
7.0.150.0030.01219.19
7.0.140.0060.04322.56
7.0.130.0060.01219.36
7.0.120.0060.01419.46
7.0.110.0070.01319.52
7.0.100.0120.04721.48
7.0.90.0030.04821.41
7.0.80.0130.04521.40
7.0.70.0100.04321.42
7.0.60.0080.04521.46
7.0.50.0100.04921.67
7.0.40.0130.02816.73
7.0.30.0080.03516.88
7.0.20.0070.05116.77
7.0.10.0100.04216.76
7.0.00.0100.03416.71
5.6.400.0100.02420.66
5.6.390.0170.01720.71
5.6.380.0130.02320.85
5.6.370.0040.02921.02
5.6.360.0040.02820.88
5.6.350.0070.02520.96
5.6.340.0040.02821.00
5.6.330.0100.02320.42
5.6.320.0070.02020.82
5.6.310.0070.02920.55
5.6.300.0070.02521.00
5.6.290.0070.02520.75
5.6.280.0080.06024.12
5.6.270.0100.02120.45
5.6.260.0040.02820.93
5.6.250.0080.04223.79
5.6.240.0120.06023.88
5.6.230.0100.05523.63
5.6.220.0100.05723.66
5.6.210.0150.04023.70
5.6.200.0050.06423.95
5.6.190.0100.05423.83
5.6.180.0130.04824.09
5.6.170.0120.04723.99
5.6.160.0080.05823.87
5.6.150.0130.05923.91
5.6.140.0220.05023.89
5.6.130.0030.06423.92
5.6.120.0130.06023.99
5.6.110.0030.06723.90
5.6.100.0200.04623.82
5.6.90.0160.05523.95
5.6.80.0120.05623.67
5.6.70.0080.05423.56
5.6.60.0140.05423.60
5.6.50.0080.05423.63
5.6.40.0030.04323.55
5.6.30.0050.05223.58
5.6.20.0080.06023.57
5.6.10.0070.06223.53
5.6.00.0150.05023.53
5.5.380.0200.04423.59
5.5.370.0150.05823.57
5.5.360.0050.06623.50
5.5.350.0100.04023.50
5.5.340.0070.06223.78
5.5.330.0120.05523.74
5.5.320.0080.06023.79
5.5.310.0050.06523.89
5.5.300.0100.04523.72
5.5.290.0070.05323.77
5.5.280.0170.04523.94
5.5.270.0080.04623.64
5.5.260.0110.05623.90
5.5.250.0120.05623.80
5.5.240.0100.05823.33
5.5.230.0120.05723.58
5.5.220.0080.05423.38
5.5.210.0070.06223.54
5.5.200.0020.05623.55
5.5.190.0080.05623.56
5.5.180.0150.05623.44
5.5.170.0000.02820.57
5.5.160.0100.03923.33
5.5.150.0150.05123.54
5.5.140.0120.06023.24
5.5.130.0080.06223.49
5.5.120.0080.05423.21
5.5.110.0130.05323.33
5.5.100.0120.05723.51
5.5.90.0160.04123.31
5.5.80.0070.06023.34
5.5.70.0100.05623.42
5.5.60.0050.05323.48
5.5.50.0120.04024.26
5.5.40.0130.05724.33
5.5.30.0170.05524.52
5.5.20.0080.06324.49
5.5.10.0100.05824.36
5.5.00.0070.06224.49
5.4.450.0150.04722.42
5.4.440.0130.05122.37
5.4.430.0050.05322.44
5.4.420.0130.05322.40
5.4.410.0080.05122.38
5.4.400.0080.05522.26
5.4.390.0150.03622.18
5.4.380.0080.05722.30
5.4.370.0100.04022.30
5.4.360.0230.04822.31
5.4.350.0070.06022.35
5.4.340.0080.06322.22
5.4.330.0100.02318.54
5.4.320.0060.04422.28
5.4.310.0080.05722.14
5.4.300.0100.06122.30
5.4.290.0150.05022.29
5.4.280.0120.05822.21
5.4.270.0130.05222.30
5.4.260.0080.04322.27
5.4.250.0030.06522.17
5.4.240.0050.06522.12
5.4.230.0080.05922.11
5.4.220.0130.05122.17
5.4.210.0080.04022.31
5.4.200.0100.05422.36
5.4.190.0050.06722.16
5.4.180.0130.05622.22
5.4.170.0080.04322.29
5.4.160.0100.05922.23
5.4.150.0100.05522.24
5.4.140.0070.06621.03
5.4.130.0130.05320.95
5.4.120.0190.04420.87
5.4.110.0070.03620.76
5.4.100.0160.05120.95
5.4.90.0100.05521.01
5.4.80.0130.05321.05
5.4.70.0150.03921.02
5.4.60.0080.05420.90
5.4.50.0150.04820.91
5.4.40.0110.05020.74
5.4.30.0020.06421.05
5.4.20.0170.04521.04
5.4.10.0120.04320.96
5.4.00.0030.06120.65
5.3.290.0050.06019.81
5.3.280.0070.04319.67
5.3.270.0070.06019.76
5.3.260.0100.06019.66
5.3.250.0080.05319.67
5.3.240.0070.05519.50
5.3.230.0080.06019.49
5.3.220.0100.05519.58
5.3.210.0150.03819.61
5.3.200.0050.03919.63
5.3.190.0070.06019.63
5.3.180.0070.05219.79
5.3.170.0030.05719.70
5.3.160.0050.05619.67
5.3.150.0120.05819.63
5.3.140.0150.05619.65
5.3.130.0070.05819.52
5.3.120.0060.05219.60
5.3.110.0070.03719.64
5.3.100.0130.03619.32
5.3.90.0050.06019.43
5.3.80.0100.04019.28
5.3.70.0100.05519.29
5.3.60.0160.04819.21
5.3.50.0050.05819.19
5.3.40.0070.05619.22
5.3.30.0080.05719.20
5.3.20.0130.04719.12
5.3.10.0100.05419.03
5.3.00.0080.05817.67
5.2.170.0100.08319.68
5.2.160.0000.05719.20
5.2.150.0130.08019.20
5.2.140.0100.07019.28
5.2.130.0200.07019.30
5.2.120.0100.05019.28
5.2.110.0130.08319.45
5.2.100.0070.05319.38
5.2.90.0170.07319.39
5.2.80.0130.06719.33
5.2.70.0130.04719.30
5.2.60.0070.08019.32
5.2.50.0100.07718.74
5.2.40.0130.08718.74
5.2.30.0130.07718.56
5.2.20.0070.08718.61
5.2.10.0000.07718.70
5.2.00.0070.08018.61
5.1.60.0000.07719.23
5.1.50.0130.07319.34
5.1.40.0170.06019.16
5.1.30.0030.08319.48
5.1.20.0130.07019.62
5.1.10.0200.06019.24
5.1.00.0030.05319.24
5.0.50.0000.0278.61
5.0.40.0000.0508.47
5.0.30.0030.0638.46
5.0.20.0070.0378.46
5.0.10.0030.0208.46
5.0.00.0070.0578.46
4.4.90.0000.0308.46
4.4.80.0070.0178.46
4.4.70.0000.0408.46
4.4.60.0030.0308.46
4.4.50.0030.0338.46
4.4.40.0000.0608.46
4.4.30.0000.0408.46
4.4.20.0070.0308.46
4.4.10.0030.0308.46
4.4.00.0000.0508.46
4.3.110.0000.0208.46
4.3.100.0000.0378.46
4.3.90.0030.0208.46
4.3.80.0070.0438.46
4.3.70.0000.0378.46
4.3.60.0000.0278.46
4.3.50.0000.0308.46
4.3.40.0030.0438.46
4.3.30.0000.0378.46
4.3.20.0030.0238.46
4.3.10.0000.0238.46
4.3.00.0070.0378.46

preferences:
37.34 ms | 401 KiB | 5 Q