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; } abstract class merging { public static function merge(array &$a, array &$b) { foreach ($b as $key => $value) { if (array_key_exists($key, $a)) { if (is_int($key)) { $a[] = $value; } elseif (is_array($value) && is_array($a[$key])) { $a[$key] = static::merge($a[$key], $value); } else { $a[$key] = $value; } } else { $a[$key] = $value; } } } } $startTimeFunc = microtime(true); merging::merge($classmap1, $classmap2); $endTimeFunc = microtime(true); echo "Func took " . (($endTimeFunc - $startTimeFunc)*1000) ." microseconds<br />\n"; //var_dump($am);

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.0130.01317.89
7.4.00.0060.02218.03
7.3.130.0140.01417.87
7.3.120.0100.01618.05
7.3.110.0060.01518.01
7.3.100.0100.01017.78
7.3.90.0060.01917.72
7.3.80.0140.00317.88
7.3.70.0040.01817.45
7.3.60.0110.01117.92
7.3.50.0030.01717.77
7.3.40.0100.01017.63
7.3.30.0040.01417.73
7.3.20.0090.01220.54
7.3.10.0030.01020.41
7.3.00.0110.00720.74
7.2.260.0140.01417.99
7.2.250.0030.01917.39
7.2.240.0060.01517.52
7.2.230.0070.01417.71
7.2.220.0170.00717.73
7.2.210.0040.01817.49
7.2.200.0130.00617.68
7.2.190.0090.01217.45
7.2.180.0000.02117.70
7.2.170.0030.01717.79
7.2.160.0100.01317.67
7.2.150.0090.00618.51
7.2.140.0080.01218.68
7.2.130.0030.01418.97
7.2.120.0180.00318.96
7.2.110.0060.01318.95
7.2.100.0000.01718.93
7.2.90.0060.01318.93
7.2.80.0000.01918.82
7.2.70.0060.01519.00
7.2.60.0130.00718.86
7.2.50.0100.01018.73
7.2.40.0000.01818.69
7.2.30.0030.01618.89
7.2.20.0000.02018.83
7.2.10.0000.01918.68
7.2.00.0020.01620.08
7.1.330.0000.01917.85
7.1.320.0060.01917.76
7.1.310.0120.01217.59
7.1.300.0090.01217.72
7.1.290.0060.01617.75
7.1.280.0030.01717.82
7.1.270.0060.01317.68
7.1.260.0030.01417.41
7.1.250.0070.01417.82
7.1.240.0040.01117.66
7.1.230.0000.01417.59
7.1.220.0070.01117.64
7.1.210.0060.01517.50
7.1.200.0000.01817.75
7.1.190.0120.00917.49
7.1.180.0000.01817.55
7.1.170.0000.02317.75
7.1.160.0070.01317.83
7.1.150.0030.01617.73
7.1.140.0070.01317.73
7.1.130.0000.02017.89
7.1.120.0100.01017.77
7.1.110.0100.01017.79
7.1.100.0030.02017.54
7.1.90.0070.01317.92
7.1.80.0060.01317.74
7.1.70.0000.02018.26
7.1.60.0030.02218.60
7.1.50.0020.02018.32
7.1.40.0000.01917.59
7.1.30.0080.01217.80
7.1.20.0030.01217.54
7.1.10.0030.01317.68
7.1.00.0040.03820.99
7.0.330.0070.01317.34
7.0.320.0070.01117.51
7.0.310.0040.01117.48
7.0.300.0080.01117.28
7.0.290.0100.01017.41
7.0.280.0040.01517.17
7.0.270.0030.01617.24
7.0.260.0030.01617.38
7.0.250.0100.01017.56
7.0.240.0000.02017.26
7.0.230.0070.01117.39
7.0.220.0100.01317.41
7.0.210.0000.01717.41
7.0.200.0030.01418.15
7.0.190.0030.01617.19
7.0.180.0030.01617.48
7.0.170.0030.01617.34
7.0.160.0040.01517.34
7.0.150.0070.01117.19
7.0.140.0080.04420.73
7.0.130.0070.01417.45
7.0.120.0060.01317.41
7.0.110.0030.01617.48
7.0.100.0150.04220.05
7.0.90.0130.04619.99
7.0.80.0070.03519.94
7.0.70.0130.05019.96
7.0.60.0050.05020.09
7.0.50.0080.03620.30
7.0.40.0030.05216.75
7.0.30.0070.03716.94
7.0.20.0030.03016.60
7.0.10.0070.04716.91
7.0.00.0050.05016.82
5.6.400.4052.08918.93
5.6.390.4882.00718.82
5.6.380.4552.04018.96
5.6.370.4782.01718.40
5.6.360.4712.00418.50
5.6.350.3752.11518.91
5.6.340.4252.06719.06
5.6.330.3992.09618.42
5.6.320.4692.02318.93
5.6.310.4652.03018.54
5.6.300.4822.00019.00
5.6.290.5021.99318.79
5.6.280.4062.09022.26
5.6.270.5051.98918.82
5.6.260.4941.99419.10
5.6.250.3982.09922.13
5.6.240.4362.06122.02
5.6.230.4602.03322.15
5.6.220.4042.09222.02
5.6.210.4232.07522.16
5.6.200.4722.02522.31
5.6.190.4142.08222.20
5.6.180.6081.88822.22
5.6.170.4202.06522.29
5.6.160.4562.03522.33
5.6.150.4212.05422.40
5.6.140.2142.28322.47
5.6.130.4412.04922.28
5.6.120.4262.07122.23
5.6.110.4212.07722.31
5.6.100.4402.05022.37
5.6.90.4892.00722.23
5.6.80.4482.05021.94
5.6.70.4202.07021.84
5.6.60.4232.06421.95
5.6.50.4462.03821.79
5.6.40.4372.05422.06
5.6.30.4282.06921.88
5.6.20.4682.02922.09
5.6.10.4072.08421.91
5.6.00.4292.06821.88
5.5.380.4582.03522.01
5.5.370.4711.98422.00
5.5.360.4771.97021.80
5.5.350.4512.00921.92
5.5.340.4632.00122.13
5.5.330.4691.97321.99
5.5.320.4801.97221.92
5.5.310.4961.96522.18
5.5.300.4911.97521.99
5.5.290.4642.00022.18
5.5.280.4232.05822.03
5.5.270.4461.98322.10
5.5.260.4551.98122.26
5.5.250.4142.05121.81
5.5.240.4312.04521.51
5.5.230.4711.95921.73
5.5.220.4641.99121.68
5.5.210.4412.03121.83
5.5.200.4462.02121.74
5.5.190.4342.03221.74
5.5.180.4142.03921.79
5.5.170.4292.06618.93
5.5.160.4522.03021.85
5.5.150.4032.06721.77
5.5.140.3882.08021.71
5.5.130.4312.04121.80
5.5.120.4611.99921.64
5.5.110.4142.06121.57
5.5.100.4302.03221.58
5.5.90.4582.01821.74
5.5.80.4681.99921.61
5.5.70.4462.00421.74
5.5.60.4562.00521.56
5.5.50.4772.00421.68
5.5.40.4092.06021.63
5.5.30.4362.03121.71
5.5.20.4162.04321.51
5.5.10.4182.06321.43
5.5.00.4292.02321.65
5.4.450.4242.04219.62
5.4.440.4242.05319.59
5.4.430.4042.04319.73
5.4.420.4241.99519.60
5.4.410.4282.03819.71
5.4.400.4192.03619.55
5.4.390.4641.97519.49
5.4.380.4472.00919.52
5.4.370.4262.05119.26
5.4.360.4402.03019.28
5.4.350.4312.03219.34
5.4.340.4392.02619.44
5.4.330.3992.09515.64
5.4.320.4531.99519.44
5.4.310.4801.98119.44
5.4.300.4592.01119.34
5.4.290.5191.94819.33
5.4.280.4901.98419.62
5.4.270.4342.03019.45
5.4.260.4861.97919.64
5.4.250.4372.03419.38
5.4.240.4562.01319.23
5.4.230.4462.02419.37
5.4.220.4392.02919.54
5.4.210.4681.99419.48
5.4.200.4522.00519.36
5.4.190.4232.05619.50
5.4.180.4222.04319.33
5.4.170.4692.00619.32
5.4.160.4222.04819.56
5.4.150.4881.97419.26
5.4.140.4562.00918.10
5.4.130.4612.01318.18
5.4.120.4811.99618.13
5.4.110.4152.05418.20
5.4.100.4062.06918.12
5.4.90.4642.01318.09
5.4.80.4482.02518.18
5.4.70.2462.21318.33
5.4.60.4712.00418.15
5.4.50.5041.95718.21
5.4.40.4282.02618.23
5.4.30.4562.00218.01
5.4.20.4432.03918.22
5.4.10.4941.97918.01
5.4.00.4232.05817.80
5.3.290.3722.05716.66
5.3.280.3932.08916.63
5.3.270.4222.04916.84
5.3.260.3712.10316.83
5.3.250.4022.04716.76
5.3.240.4082.06116.54
5.3.230.3912.04016.56
5.3.220.4212.04816.81
5.3.210.4042.04816.65
5.3.200.3892.05616.57
5.3.190.4112.03816.68
5.3.180.3992.07516.71
5.3.170.4142.05116.79
5.3.160.3972.06716.82
5.3.150.4432.02916.91
5.3.140.4262.04116.62
5.3.130.4432.03416.67
5.3.120.4402.02516.71
5.3.110.3932.07916.63
5.3.100.4252.03216.45
5.3.90.4112.06116.57
5.3.80.3852.08016.36
5.3.70.4092.06716.33
5.3.60.4052.06416.32
5.3.50.3742.10116.34
5.3.40.4402.04116.39
5.3.30.4012.07216.36
5.3.20.4652.01716.25
5.3.10.4152.03616.12
5.3.00.4012.06015.96
5.2.170.0070.06012.83
5.2.160.0100.05312.83
5.2.150.0070.03012.83
5.2.140.0070.03312.83
5.2.130.0070.06012.83
5.2.120.0070.06012.83
5.2.110.0070.06012.83
5.2.100.0030.05012.83
5.2.90.0000.03712.83
5.2.80.0100.05712.83
5.2.70.0100.05712.83
5.2.60.0100.04712.83
5.2.50.0030.06312.83
5.2.40.0130.05012.83
5.2.30.0070.05712.83
5.2.20.0100.05712.83
5.2.10.0030.04312.83
5.2.00.0030.06712.83
5.1.60.0170.03712.83
5.1.50.0100.05012.83
5.1.40.0030.05312.83
5.1.30.0030.05712.83
5.1.20.0030.05012.83
5.1.10.0070.04312.83
5.1.00.0030.05312.83
5.0.50.0070.04712.83
5.0.40.0070.04012.83
5.0.30.0030.05712.83
5.0.20.0030.04312.83
5.0.10.0070.04312.83
5.0.00.0030.05712.83
4.4.90.0000.03712.83
4.4.80.0000.03312.83
4.4.70.0030.02012.83
4.4.60.0000.03712.83
4.4.50.0030.03012.83
4.4.40.0000.04312.83
4.4.30.0000.01712.83
4.4.20.0070.02312.83
4.4.10.0030.03712.83
4.4.00.0030.05312.83
4.3.110.0030.03712.83
4.3.100.0100.02712.83
4.3.90.0000.03012.83
4.3.80.0000.06012.83
4.3.70.0130.02312.83
4.3.60.0000.03712.83
4.3.50.0030.03712.83
4.3.40.0000.04012.83
4.3.30.0000.03712.83
4.3.20.0030.03012.83
4.3.10.0030.03712.83
4.3.00.0000.03712.83

preferences:
40.91 ms | 401 KiB | 5 Q