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; } } return $a; } } $startTimeFunc = microtime(true); $am = 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.3.10.0100.01420.81
7.3.00.0130.01320.46
7.2.130.0060.01318.69
7.2.120.0000.01418.84
7.2.110.0000.01918.79
7.2.100.0070.01018.85
7.2.90.0140.00318.79
7.2.80.0090.01218.74
7.2.70.0100.01818.82
7.2.60.0120.00919.02
7.2.50.0250.00918.98
7.2.40.0070.01018.80
7.2.30.0100.02018.63
7.2.20.0070.01718.85
7.2.10.0090.01518.84
7.2.00.0050.01419.97
7.1.250.0140.01117.48
7.1.70.0030.01319.19
7.1.60.0070.01419.33
7.1.50.0040.01118.86
7.1.00.0030.08024.21
7.0.200.0300.00017.31
7.0.140.0070.07324.08
7.0.100.0170.07322.62
7.0.90.0130.07722.49
7.0.80.0100.08722.62
7.0.70.0300.07022.53
7.0.60.0100.07322.51
7.0.50.0230.04022.98
7.0.40.0170.08019.99
7.0.30.0000.04720.08
7.0.20.0070.08720.05
7.0.10.0030.07720.08
7.0.00.0100.08020.00
5.6.280.3602.14025.64
5.6.250.4732.02725.39
5.6.240.3832.11725.44
5.6.230.4502.05025.29
5.6.220.4832.01725.45
5.6.210.4832.01725.45
5.6.200.4572.04325.74
5.6.190.4202.08025.79
5.6.180.3902.11025.74
5.6.170.4102.09025.77
5.6.160.4802.02025.81
5.6.150.3972.10325.78
5.6.140.4272.07325.73
5.6.130.3802.12025.76
5.6.120.5031.99725.77
5.6.110.5071.96325.59
5.6.100.4472.02325.84
5.6.90.3702.13025.67
5.6.80.4532.04025.13
5.6.70.7071.77025.13
5.6.60.4432.03325.22
5.6.50.4632.00725.24
5.6.40.4402.03724.98
5.6.30.3702.10325.09
5.6.20.3801.91325.22
5.6.10.4931.99025.18
5.6.00.3531.89725.11
5.5.380.4132.08725.14
5.5.370.4672.03325.11
5.5.360.4872.01325.09
5.5.350.4802.02025.21
5.5.340.4202.08025.71
5.5.330.4402.06025.45
5.5.320.4632.03725.48
5.5.310.4972.00325.61
5.5.300.4702.03025.52
5.5.290.4572.04325.64
5.5.280.5131.98725.52
5.5.270.4732.02725.56
5.5.260.4032.09725.45
5.5.250.4502.05025.36
5.5.240.4072.09324.90
5.5.230.4572.02324.88
5.5.220.4202.05024.82
5.5.210.4701.93724.85
5.5.200.5171.96724.88
5.5.190.4402.02724.91
5.5.180.5031.98325.03
5.5.160.3972.07724.91
5.5.150.5131.97724.79
5.5.140.0032.36724.96
5.5.130.4301.97024.73
5.5.120.4771.96324.97
5.5.110.3671.91024.85
5.5.100.4632.00324.86
5.5.90.4871.98024.65
5.5.80.3802.02024.74
5.5.70.4271.99324.79
5.5.60.5001.93324.71
5.5.50.4631.86324.62
5.5.40.5031.96324.59
5.5.30.4871.98024.92
5.5.20.4372.01024.79
5.5.10.4102.03724.73
5.5.00.5001.96024.76
5.4.450.4332.06724.11
5.4.440.4072.09324.13
5.4.430.4002.07324.08
5.4.420.4772.02324.09
5.4.410.5071.99323.89
5.4.400.4372.06323.78
5.4.390.0072.48324.00
5.4.380.3902.11023.91
5.4.370.4302.07023.51
5.4.360.4702.03023.62
5.4.350.4502.00323.62
5.4.340.5171.98323.52
5.4.320.4232.07723.94
5.4.310.4672.03323.73
5.4.300.4302.03023.76
5.4.290.4272.04023.55
5.4.280.4632.00323.56
5.4.270.4572.04323.56
5.4.260.4602.02023.69
5.4.250.4802.02023.73
5.4.240.4102.09023.71
5.4.230.5001.95023.78
5.4.220.4632.03723.56
5.4.210.5001.96323.52
5.4.200.5231.97723.73
5.4.190.4772.02323.80
5.4.180.4972.00323.72
5.4.170.3872.07723.69
5.4.160.3902.11023.54
5.4.150.4172.02723.48
5.4.140.4831.92320.94
5.4.130.4731.99020.99
5.4.120.4432.05721.06
5.4.110.4172.08320.99
5.4.100.4702.03021.22
5.4.90.4272.07321.08
5.4.80.4402.06021.20
5.4.70.4532.04721.30
5.4.60.4172.08321.04
5.4.50.5201.98021.14
5.4.40.4632.03721.19
5.4.30.4632.03721.07
5.4.20.4602.04020.99
5.4.10.4832.01721.23
5.4.00.5471.95320.48
5.3.290.4432.05719.13
5.3.280.4132.08719.20
5.3.270.3932.08019.29
5.3.260.4432.05719.34
5.3.250.4572.01019.00
5.3.240.4732.02719.37
5.3.230.4432.05719.35
5.3.220.4802.02019.33
5.3.210.4632.03718.93
5.3.200.0172.48319.39
5.3.190.4632.03719.30
5.3.180.4732.02719.15
5.3.170.4332.06719.23
5.3.160.3902.11018.97
5.3.150.4832.01719.01
5.3.140.4272.07318.86
5.3.130.4532.04719.18
5.3.120.4472.05319.26
5.3.110.4172.08319.24
5.3.100.4572.04318.57
5.3.90.3972.10318.58
5.3.80.4132.08018.32
5.3.70.4132.08718.57
5.3.60.0132.45718.75
5.3.50.6001.87318.27
5.3.40.4532.02018.23
5.3.30.3502.04018.29
5.3.20.4231.99318.08
5.3.10.3872.04018.20
5.3.00.4202.05718.22
5.2.170.0070.06311.03
5.2.160.0130.05711.10
5.2.150.0100.05311.18
5.2.140.0030.05011.24
5.2.130.0030.02711.25
5.2.120.0000.03311.24
5.2.110.0030.02711.05
5.2.100.0070.05711.19
5.2.90.0070.05711.16
5.2.80.0070.06010.99
5.2.70.0000.06711.09
5.2.60.0030.06710.99
5.2.50.0030.06010.91
5.2.40.0030.06011.13
5.2.30.0070.04311.09
5.2.20.0170.04711.04
5.2.10.0130.05010.92
5.2.00.0030.05710.70
5.1.60.0030.04710.34
5.1.50.0070.05310.34
5.1.40.0070.05310.34
5.1.30.0030.03010.37
5.1.20.0000.06310.43
5.1.10.0070.05710.34
5.1.00.0030.04310.34
5.0.50.0030.04710.34
5.0.40.0030.04310.34
5.0.30.0000.06710.34
5.0.20.0000.04010.34
5.0.10.0070.03310.34
5.0.00.0030.06710.34
4.4.90.0030.03710.34
4.4.80.0030.03010.34
4.4.70.0070.03010.34
4.4.60.0030.03010.34
4.4.50.0000.03310.34
4.4.40.0070.04310.34
4.4.30.0030.03710.34
4.4.20.0070.03010.34
4.4.10.0070.03310.34
4.4.00.0070.04710.34
4.3.110.0030.03710.34
4.3.100.0000.03710.34
4.3.90.0030.03310.34
4.3.80.0030.05310.34
4.3.70.0000.03710.34
4.3.60.0030.02710.34
4.3.50.0100.02310.34
4.3.40.0070.05010.34
4.3.30.0070.02310.34
4.3.20.0070.03310.34
4.3.10.0030.03710.34
4.3.00.0030.03310.34

preferences:
37.56 ms | 401 KiB | 5 Q