3v4l.org

run code in 300+ PHP versions simultaneously
<?php $classmap1 = array(); for ($i=1; $i<=500; $i++) { $classmap1['a'.$i] = $i+1; } $classmap2 = array(); for ($i=1; $i<=500; $i++) { $classmap2['b'.$i] = $i+1; } abstract class merging { public static function merge(array $a, array $b) { foreach ($b as $key => $value) { if (isset($a[$key])) { 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); merging::merge($classmap1, $classmap2); $endTimeFunc = microtime(true); 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.3.10.0110.00616.72
7.3.00.0060.00816.57
7.2.130.0070.00316.93
7.2.120.0040.00817.02
7.2.110.0070.00316.96
7.2.100.0140.00316.97
7.2.90.0070.00716.80
7.2.80.0030.01016.73
7.2.70.0030.00916.79
7.2.60.0070.00716.94
7.2.50.0100.00316.76
7.2.40.0030.00916.80
7.2.30.0060.00617.03
7.2.20.0030.01016.69
7.2.10.0060.00616.98
7.2.00.0050.01017.99
7.1.250.0000.01015.95
7.1.70.0030.00517.21
7.1.60.0060.01919.32
7.1.50.0000.01517.00
7.1.00.0000.05322.32
7.0.200.0210.00416.67
7.0.140.0030.07322.04
7.0.100.0030.08020.07
7.0.90.0130.07720.04
7.0.80.0070.08719.99
7.0.70.0030.05720.01
7.0.60.0130.07319.90
7.0.50.0030.05020.45
7.0.40.0100.08320.09
7.0.30.0170.07720.13
7.0.20.0030.08720.14
7.0.10.0070.08719.99
7.0.00.0130.08320.03
5.6.280.0000.08021.18
5.6.250.0270.03721.10
5.6.240.0100.08020.96
5.6.230.0030.05320.88
5.6.220.0030.07320.96
5.6.210.0070.07320.97
5.6.200.0070.05021.23
5.6.190.0030.09021.36
5.6.180.0130.07721.40
5.6.170.0070.07721.39
5.6.160.0170.07721.39
5.6.150.0170.07021.42
5.6.140.0100.06721.32
5.6.130.0070.08721.24
5.6.120.0070.09021.34
5.6.110.0100.08321.32
5.6.100.0100.07721.38
5.6.90.0130.04321.37
5.6.80.0130.07320.63
5.6.70.0100.08720.71
5.6.60.0030.08320.69
5.6.50.0200.07020.72
5.6.40.0070.07320.69
5.6.30.0130.07320.78
5.6.20.0200.07020.67
5.6.10.0030.08020.70
5.6.00.0070.04720.80
5.5.380.0170.07320.86
5.5.370.0070.05720.80
5.5.360.0130.07020.82
5.5.350.0100.04720.74
5.5.340.0170.07721.14
5.5.330.0030.09321.21
5.5.320.0030.07020.89
5.5.310.0070.08321.08
5.5.300.0100.04721.21
5.5.290.0070.08021.19
5.5.280.0100.07721.19
5.5.270.0170.04321.03
5.5.260.0030.08321.05
5.5.250.0100.06020.89
5.5.240.0070.08020.56
5.5.230.0000.07720.53
5.5.220.0100.07720.52
5.5.210.0100.07320.50
5.5.200.0000.05020.41
5.5.190.0130.07720.41
5.5.180.0100.07320.44
5.5.160.0070.08320.54
5.5.150.0130.07320.37
5.5.140.0100.06720.47
5.5.130.0030.05720.43
5.5.120.0100.08020.49
5.5.110.0030.05720.53
5.5.100.0200.07020.36
5.5.90.0170.07320.46
5.5.80.0170.06720.38
5.5.70.0170.07020.43
5.5.60.0270.06020.30
5.5.50.0100.08020.33
5.5.40.0000.05320.28
5.5.30.0030.08320.42
5.5.20.0000.09020.35
5.5.10.0070.08320.32
5.5.00.0170.03020.30
5.4.450.0030.05019.66
5.4.440.0100.08019.66
5.4.430.0130.04319.56
5.4.420.0100.08019.44
5.4.410.0130.04719.60
5.4.400.0170.07319.12
5.4.390.0070.08019.05
5.4.380.0000.09019.32
5.4.370.0000.08019.25
5.4.360.0030.06019.36
5.4.350.0130.06719.26
5.4.340.0100.07019.41
5.4.320.0100.07719.21
5.4.310.0130.06719.28
5.4.300.0100.07019.21
5.4.290.0100.07319.21
5.4.280.0070.07719.27
5.4.270.0100.07319.17
5.4.260.0070.07719.08
5.4.250.0100.04719.11
5.4.240.0170.07319.11
5.4.230.0070.04319.11
5.4.220.0030.07319.28
5.4.210.0030.05719.30
5.4.200.0070.07719.27
5.4.190.0070.07319.23
5.4.180.0030.06019.26
5.4.170.0100.05719.11
5.4.160.0130.05019.25
5.4.150.0100.03319.05
5.4.140.0000.04016.69
5.4.130.0030.05716.50
5.4.120.0030.03716.56
5.4.110.0070.03716.59
5.4.100.0000.04016.75
5.4.90.0030.04316.53
5.4.80.0030.04316.69
5.4.70.0070.03016.58
5.4.60.0000.04016.60
5.4.50.0170.05316.71
5.4.40.0030.04316.66
5.4.30.0030.05016.61
5.4.20.0070.03716.58
5.4.10.0030.03716.74
5.4.00.0000.04316.09
5.3.290.0070.08014.98
5.3.280.0030.07714.97
5.3.270.0130.07715.04
5.3.260.0030.05314.96
5.3.250.0100.03714.92
5.3.240.0000.04014.99
5.3.230.0070.04014.84
5.3.220.0070.03714.84
5.3.210.0000.04714.93
5.3.200.0030.04314.83
5.3.190.0130.02714.86
5.3.180.0000.04014.84
5.3.170.0070.03014.81
5.3.160.0030.03714.96
5.3.150.0030.03714.78
5.3.140.0100.03714.91
5.3.130.0070.04014.81
5.3.120.0030.04314.83
5.3.110.0000.04014.82
5.3.100.0030.03714.29
5.3.90.0030.03314.29
5.3.80.0100.03314.45
5.3.70.0000.04314.23
5.3.60.0070.03314.31
5.3.50.0030.05714.25
5.3.40.0000.04014.21
5.3.30.0070.05014.05
5.3.20.0070.03313.89
5.3.10.0000.03714.08
5.3.00.0130.02313.86
5.2.170.0000.03011.24
5.2.160.0100.04311.04
5.2.150.0030.03011.26
5.2.140.0030.02711.15
5.2.130.0000.03311.21
5.2.120.0000.03011.13
5.2.110.0030.02711.17
5.2.100.0030.02711.04
5.2.90.0000.03011.17
5.2.80.0070.02311.02
5.2.70.0000.04011.16
5.2.60.0000.03011.18
5.2.50.0000.03711.05
5.2.40.0030.02711.06
5.2.30.0070.02711.03
5.2.20.0000.03311.11
5.2.10.0030.02710.93
5.2.00.0030.03010.79
5.1.60.0030.02310.00
5.1.50.0030.02010.01
5.1.40.0070.0279.95
5.1.30.0000.03310.43
5.1.20.0030.02010.42
5.1.10.0000.03310.10
5.1.00.0000.04710.11
5.0.50.0070.0278.69
5.0.40.0000.0238.69
5.0.30.0000.0578.69
5.0.20.0000.0478.69
5.0.10.0030.0278.69
5.0.00.0070.0638.69
4.4.90.0000.0138.69
4.4.80.0070.0108.69
4.4.70.0070.0108.69
4.4.60.0000.0178.69
4.4.50.0000.0178.69
4.4.40.0000.0278.69
4.4.30.0000.0138.69
4.4.20.0030.0208.69
4.4.10.0030.0138.69
4.4.00.0030.0338.69
4.3.110.0070.0208.69
4.3.100.0070.0238.69
4.3.90.0000.0308.69
4.3.80.0000.0578.69
4.3.70.0030.0138.69
4.3.60.0030.0338.69
4.3.50.0000.0208.69
4.3.40.0000.0538.69
4.3.30.0030.0338.69
4.3.20.0000.0338.69
4.3.10.0030.0338.69
4.3.00.0030.0238.69

preferences:
36.95 ms | 401 KiB | 5 Q