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, $performance = false) { foreach ($b as $key => $value) { $a[$key] = $value; } return $a; } $startTimeFunc = microtime(true); amerge($classmap1, $classmap2, true); $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.10.0160.01219.42
7.4.00.0100.01719.41
7.3.130.0150.01219.21
7.3.120.0070.01919.25
7.3.110.0080.02019.47
7.3.100.0090.01019.42
7.3.90.0070.01219.54
7.3.80.0070.01019.23
7.3.70.0090.01119.39
7.3.60.0020.02119.30
7.3.50.0100.01019.09
7.3.40.0090.01319.38
7.3.30.0110.01019.17
7.3.20.0050.01324.77
7.3.10.0020.01624.41
7.3.00.0060.01424.61
7.2.260.0130.01619.14
7.2.250.0110.01818.66
7.2.240.0120.01518.98
7.2.230.0150.00619.07
7.2.220.0070.01119.07
7.2.210.0060.01119.03
7.2.200.0060.01718.97
7.2.190.0080.00918.95
7.2.180.0090.01118.93
7.2.170.0130.01018.89
7.2.160.0090.00918.97
7.2.150.0070.01422.72
7.2.140.0100.00722.89
7.2.130.0070.01122.80
7.2.120.0070.01522.89
7.2.110.0070.01322.84
7.2.100.0020.01922.82
7.2.90.0080.01322.86
7.2.80.0060.01422.94
7.2.70.0050.01422.68
7.2.60.0050.01522.85
7.2.50.0050.01422.89
7.2.40.0030.01822.67
7.2.30.0030.01622.94
7.2.20.0070.01222.75
7.2.10.0050.01622.88
7.2.00.0090.01123.56
7.1.330.0070.01421.72
7.1.320.0100.01021.73
7.1.310.0050.01321.51
7.1.300.0070.01521.64
7.1.290.0100.01221.68
7.1.280.0080.01221.68
7.1.270.0020.02221.81
7.1.260.0060.01521.64
7.1.250.0060.01421.82
7.1.240.0050.01721.73
7.1.230.0050.01521.63
7.1.220.0050.01721.74
7.1.210.0050.01721.56
7.1.200.0050.01621.77
7.1.190.0050.01721.69
7.1.180.0070.01521.71
7.1.170.0090.01121.67
7.1.160.0070.01621.67
7.1.150.0070.01421.59
7.1.140.0080.01221.58
7.1.130.0030.01621.63
7.1.120.0050.01521.82
7.1.110.0090.00921.70
7.1.100.0060.01421.74
7.1.90.0080.01421.77
7.1.80.0070.01321.79
7.1.70.0070.01022.08
7.1.60.0070.01422.23
7.1.50.0060.01221.84
7.1.40.0090.01221.67
7.1.30.0040.01521.66
7.1.20.0050.01521.76
7.1.10.0020.01921.70
7.1.00.0040.03323.87
7.0.330.0080.01121.21
7.0.320.0060.01521.39
7.0.310.0030.01421.30
7.0.300.0060.01121.44
7.0.290.0120.00921.39
7.0.280.0050.01721.26
7.0.270.0050.01721.43
7.0.260.0050.01621.11
7.0.250.0040.01921.45
7.0.240.0070.01521.49
7.0.230.0120.00921.20
7.0.220.0070.01321.43
7.0.210.0080.01521.24
7.0.200.0080.01021.66
7.0.190.0040.01621.37
7.0.180.0080.01421.32
7.0.170.0030.01521.50
7.0.160.0070.01521.39
7.0.150.0050.01621.18
7.0.140.0040.03823.42
7.0.130.0060.01221.43
7.0.120.0070.01421.39
7.0.110.0000.01721.36
7.0.100.0060.03722.21
7.0.90.0020.02822.35
7.0.80.0080.03422.33
7.0.70.0060.03722.22
7.0.60.0090.03622.18
7.0.50.0100.03922.48
7.0.40.0090.03615.61
7.0.30.0110.03215.57
7.0.20.0070.03615.67
7.0.10.0080.03815.71
7.0.00.0110.03615.63
5.6.400.0240.01723.71
5.6.390.0110.02523.33
5.6.380.0050.03023.88
5.6.370.0110.02323.72
5.6.360.0080.02823.49
5.6.350.0110.02523.81
5.6.340.0090.02423.87
5.6.330.0080.02523.70
5.6.320.0050.03023.58
5.6.310.0070.03023.52
5.6.300.0180.02023.43
5.6.290.0070.02724.01
5.6.280.0150.04225.87
5.6.270.0130.02223.69
5.6.260.0070.02723.81
5.6.250.0120.04925.74
5.6.240.0120.04925.76
5.6.230.0110.04425.79
5.6.220.0090.05025.71
5.6.210.0170.04425.72
5.6.200.0140.04225.86
5.6.190.0080.05025.84
5.6.180.0190.04325.87
5.6.170.0110.04625.93
5.6.160.0130.04925.84
5.6.150.0090.04725.74
5.6.140.0170.05025.79
5.6.130.0080.05125.92
5.6.120.0140.04625.90
5.6.110.0160.04525.89
5.6.100.0110.04826.04
5.6.90.0110.03825.93
5.6.80.0170.03825.55
5.6.70.0160.04525.77
5.6.60.0130.04625.72
5.6.50.0140.03425.44
5.6.40.0100.04325.59
5.6.30.0110.05225.74
5.6.20.0110.04025.59
5.6.10.0100.05025.63
5.6.00.0080.05225.61
5.5.380.0080.05124.57
5.5.370.0130.04824.60
5.5.360.0130.04124.79
5.5.350.0050.05424.67
5.5.340.0080.04824.76
5.5.330.0140.04824.81
5.5.320.0080.05224.92
5.5.310.0100.04424.82
5.5.300.0090.05424.79
5.5.290.0130.04324.72
5.5.280.0110.04424.73
5.5.270.0110.04824.70
5.5.260.0100.05024.64
5.5.250.0110.04624.79
5.5.240.0150.04624.51
5.5.230.0160.04224.51
5.5.220.0100.04224.49
5.5.210.0130.04824.59
5.5.200.0100.04924.43
5.5.190.0090.04624.53
5.5.180.0120.03924.54
5.5.170.0090.02922.07
5.5.160.0100.05024.63
5.5.150.0090.04624.43
5.5.140.0090.04724.52
5.5.130.0090.04824.55
5.5.120.0080.05124.52
5.5.110.0110.04224.50
5.5.100.0120.04524.62
5.5.90.0090.04724.43
5.5.80.0100.05124.42
5.5.70.0110.04824.39
5.5.60.0130.04824.52
5.5.50.0160.04824.20
5.5.40.0110.05224.37
5.5.30.0080.05424.29
5.5.20.0110.04324.28
5.5.10.0110.04924.28
5.5.00.0080.03924.19
5.4.450.0130.04723.02
5.4.440.0100.04623.06
5.4.430.0120.04923.05
5.4.420.0130.04923.04
5.4.410.0140.05222.98
5.4.400.0130.04822.78
5.4.390.0170.04122.77
5.4.380.0140.04423.00
5.4.370.0100.05022.79
5.4.360.0120.04522.84
5.4.350.0140.04222.89
5.4.340.0100.03722.94
5.4.330.0110.02820.07
5.4.320.0170.04522.69
5.4.310.0180.04222.75
5.4.300.0140.04422.83
5.4.290.0140.05022.86
5.4.280.0110.04322.82
5.4.270.0130.04122.82
5.4.260.0110.05022.81
5.4.250.0100.05322.92
5.4.240.0110.04622.94
5.4.230.0130.04722.74
5.4.220.0140.05022.75
5.4.210.0120.04622.66
5.4.200.0100.04822.81
5.4.190.0140.04622.79
5.4.180.0080.05222.84
5.4.170.0060.04922.93
5.4.160.0130.04622.77
5.4.150.0130.04222.92
5.4.140.0090.05022.00
5.4.130.0080.05021.95
5.4.120.0120.04421.99
5.4.110.0080.04821.97
5.4.100.0120.04521.99
5.4.90.0080.04621.98
5.4.80.0150.03921.87
5.4.70.0120.04521.93
5.4.60.0120.04021.91
5.4.50.0090.04522.05
5.4.40.0080.04921.99
5.4.30.0140.04921.86
5.4.20.0100.04722.03
5.4.10.0120.04421.98
5.4.00.0100.04821.84
5.3.290.0100.05021.01
5.3.280.0100.05021.02
5.3.270.0070.05221.04
5.3.260.0080.05021.03
5.3.250.0090.04821.09
5.3.240.0050.05720.88
5.3.230.0090.05121.06
5.3.220.0080.05320.88
5.3.210.0110.04221.00
5.3.200.0070.05420.93
5.3.190.0140.04120.94
5.3.180.0100.04721.12
5.3.170.0140.04420.97
5.3.160.0110.04521.05
5.3.150.0100.04721.13
5.3.140.0160.04320.99
5.3.130.0080.05920.92
5.3.120.0100.05020.99
5.3.110.0150.04121.06
5.3.100.0170.04520.88
5.3.90.0090.04920.88
5.3.80.0070.05320.67
5.3.70.0120.04820.63
5.3.60.0110.04820.72
5.3.50.0090.05020.68
5.3.40.0090.05120.75
5.3.30.0080.03620.75
5.3.20.0120.04820.50
5.3.10.0090.03720.50
5.3.00.0070.04220.28
5.2.170.0120.05719.40
5.2.160.0080.05319.37
5.2.150.0080.03719.26
5.2.140.0080.04019.29
5.2.130.0070.03719.28
5.2.120.0100.05019.26
5.2.110.0000.04019.32
5.2.100.0080.03519.23
5.2.90.0050.03319.07
5.2.80.0100.03119.26
5.2.70.0030.03919.22
5.2.60.0030.03619.11
5.2.50.0080.03718.90
5.2.40.0030.06118.79
5.2.30.0020.05617.90
5.2.20.0030.06517.86
5.2.10.0100.04617.74
5.2.00.0070.05118.64
5.1.60.0050.03919.76
5.1.50.0080.04519.77
5.1.40.0020.04619.75
5.1.30.0070.04819.95
5.1.20.0080.03819.96
5.1.10.0080.03819.85
5.1.00.0090.03619.72
5.0.50.0070.00710.60
5.0.40.0000.01410.60
5.0.30.0040.01510.60
5.0.20.0030.01710.60
5.0.10.0020.01210.60
5.0.00.0050.02910.60
4.4.90.0020.01010.60
4.4.80.0020.01410.60
4.4.70.0020.01210.60
4.4.60.0030.01710.60
4.4.50.0020.01110.60
4.4.40.0030.02310.60
4.4.30.0000.01510.60
4.4.20.0010.00810.60
4.4.10.0020.01510.60
4.4.00.0030.01310.60
4.3.110.0020.00810.60
4.3.100.0030.01310.60
4.3.90.0010.00910.60
4.3.80.0020.01310.60
4.3.70.0010.00910.60
4.3.60.0030.01210.60
4.3.50.0030.02010.60
4.3.40.0030.02710.60
4.3.30.0020.00910.60
4.3.20.0020.01010.60
4.3.10.0000.01110.60
4.3.00.0020.01010.60

preferences:
36.15 ms | 401 KiB | 5 Q