3v4l.org

run code in 300+ PHP versions simultaneously
<?php $classmap1 = array(); for ($i=1; $i<=100; $i++) { $classmap1['a'.$i] = $i+1; } $classmap2 = array(); for ($i=1; $i<=100; $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.4.10.0070.01114.88
7.4.00.0080.01014.85
7.3.130.0120.00714.80
7.3.120.0080.01014.74
7.3.110.0050.01214.70
7.3.100.0100.00515.02
7.3.90.0060.00914.98
7.3.80.0080.00414.71
7.3.70.0040.01014.90
7.3.60.0010.01014.93
7.3.50.0020.01315.01
7.3.40.0040.00914.65
7.3.30.0110.00514.72
7.3.20.0050.01116.78
7.3.10.0080.00516.51
7.3.00.0040.00716.65
7.2.260.0070.01115.00
7.2.250.0080.00915.28
7.2.240.0070.00715.05
7.2.230.0030.01115.22
7.2.220.0080.00815.02
7.2.210.0050.00715.14
7.2.200.0090.00415.06
7.2.190.0060.00915.11
7.2.180.0130.00415.02
7.2.170.0130.00214.89
7.2.160.0030.00915.12
7.2.150.0090.00516.86
7.2.140.0060.00817.00
7.2.130.0030.01516.91
7.2.120.0060.00916.89
7.2.110.0060.00816.91
7.2.100.0090.00316.99
7.2.90.0030.01216.84
7.2.80.0070.00817.08
7.2.70.0120.00316.93
7.2.60.0030.00816.99
7.2.50.0090.00716.75
7.2.40.0080.00316.96
7.2.30.0020.01416.83
7.2.20.0080.00516.87
7.2.10.0110.00316.89
7.2.00.0060.01017.61
7.1.330.0080.00515.82
7.1.320.0050.00615.93
7.1.310.0070.00515.67
7.1.300.0090.00315.79
7.1.290.0000.01115.65
7.1.280.0040.00815.78
7.1.270.0040.01315.76
7.1.260.0050.00615.78
7.1.250.0060.01015.76
7.1.240.0050.00615.74
7.1.230.0060.00715.97
7.1.220.0080.00815.71
7.1.210.0070.01015.62
7.1.200.0090.00715.75
7.1.190.0050.00815.62
7.1.180.0070.00815.78
7.1.170.0040.00815.72
7.1.160.0040.01215.97
7.1.150.0050.01015.81
7.1.140.0020.01215.76
7.1.130.0070.00715.72
7.1.120.0080.00615.86
7.1.110.0080.00715.75
7.1.100.0050.01015.68
7.1.90.0080.00715.88
7.1.80.0020.01215.72
7.1.70.0060.00616.29
7.1.60.0050.00917.02
7.1.50.0080.00816.17
7.1.40.0080.00515.72
7.1.30.0040.01115.59
7.1.20.0050.00515.77
7.1.10.0050.00715.61
7.1.00.0030.02617.85
7.0.330.0040.00915.27
7.0.320.0030.01215.41
7.0.310.0070.00615.27
7.0.300.0060.00515.51
7.0.290.0030.01115.14
7.0.280.0060.00515.35
7.0.270.0030.00915.36
7.0.260.0090.00315.35
7.0.250.0070.00715.40
7.0.240.0040.00715.46
7.0.230.0110.00415.46
7.0.220.0060.00815.46
7.0.210.0050.00515.41
7.0.200.0150.00715.77
7.0.190.0080.00615.13
7.0.180.0040.00715.32
7.0.170.0050.00815.49
7.0.160.0030.00915.36
7.0.150.0020.01115.51
7.0.140.0060.02717.56
7.0.130.0030.01015.34
7.0.120.0040.00615.52
7.0.110.0050.00715.52
7.0.100.0050.03216.95
7.0.90.0110.02216.98
7.0.80.0130.02916.94
7.0.70.0100.02917.09
7.0.60.0110.03116.82
7.0.50.0100.02117.03
7.0.40.0100.02015.58
7.0.30.0050.02615.59
7.0.20.0090.02915.76
7.0.10.0080.01715.59
7.0.00.0100.01815.68
5.6.400.0050.00614.70
5.6.390.0080.00814.51
5.6.380.0070.00814.48
5.6.370.0080.00514.54
5.6.360.0080.00814.69
5.6.350.0040.01314.69
5.6.340.0050.00914.40
5.6.330.0080.00714.44
5.6.320.0050.00814.66
5.6.310.0060.00814.58
5.6.300.0070.00714.60
5.6.290.0060.00814.51
5.6.280.0050.02916.72
5.6.270.0020.01214.63
5.6.260.0040.01114.59
5.6.250.0050.04016.42
5.6.240.0060.02616.64
5.6.230.0050.01916.56
5.6.220.0050.03416.50
5.6.210.0030.01916.59
5.6.200.0100.01816.66
5.6.190.0090.03016.72
5.6.180.0050.02616.64
5.6.170.0060.02516.81
5.6.160.0030.01916.57
5.6.150.0100.01816.61
5.6.140.0040.02416.64
5.6.130.0050.02416.82
5.6.120.0030.02716.61
5.6.110.0030.03216.66
5.6.100.0060.02116.75
5.6.90.0030.02516.58
5.6.80.0030.03516.31
5.6.70.0100.02416.38
5.6.60.0010.02316.34
5.6.50.0080.02616.43
5.6.40.0060.02616.45
5.6.30.0040.03016.60
5.6.20.0050.02016.38
5.6.10.0060.02716.42
5.6.00.0070.01816.33
5.5.380.0060.02816.42
5.5.370.0090.02516.46
5.5.360.0020.02416.29
5.5.350.0090.02216.50
5.5.340.0080.01816.60
5.5.330.0090.03116.62
5.5.320.0070.02016.61
5.5.310.0070.01916.56
5.5.300.0070.02916.68
5.5.290.0060.03416.54
5.5.280.0100.03016.59
5.5.270.0110.02016.63
5.5.260.0070.03416.51
5.5.250.0100.02516.37
5.5.240.0090.01916.36
5.5.230.0060.03116.26
5.5.220.0090.03016.29
5.5.210.0070.02916.20
5.5.200.0080.03016.30
5.5.190.0070.02416.28
5.5.180.0030.02216.13
5.5.170.0080.00514.61
5.5.160.0060.03216.27
5.5.150.0040.03116.20
5.5.140.0060.02516.29
5.5.130.0070.03116.34
5.5.120.0030.01916.32
5.5.110.0040.02616.26
5.5.100.0090.02316.38
5.5.90.0070.01816.34
5.5.80.0090.02816.32
5.5.70.0060.02016.22
5.5.60.0070.01516.27
5.5.50.0040.02216.29
5.5.40.0050.02216.25
5.5.30.0100.02316.21
5.5.20.0100.01416.23
5.5.10.0050.03416.24
5.5.00.0040.02616.20
5.4.450.0070.02414.15
5.4.440.0000.02814.29
5.4.430.0070.01814.21
5.4.420.0070.02714.21
5.4.410.0050.02314.24
5.4.400.0060.03114.06
5.4.390.0050.02114.02
5.4.380.0020.03014.16
5.4.370.0050.02813.97
5.4.360.0030.02114.09
5.4.350.0040.02813.91
5.4.340.0020.02214.16
5.4.330.0060.00811.41
5.4.320.0050.01814.07
5.4.310.0040.02513.99
5.4.300.0070.02414.16
5.4.290.0060.03014.15
5.4.280.0030.02013.96
5.4.270.0050.02314.00
5.4.260.0050.03014.03
5.4.250.0060.02413.99
5.4.240.0030.01714.08
5.4.230.0080.01513.96
5.4.220.0080.02014.11
5.4.210.0070.01314.03
5.4.200.0030.01814.02
5.4.190.0040.02913.97
5.4.180.0060.02214.11
5.4.170.0030.01713.97
5.4.160.0040.01614.11
5.4.150.0040.02814.00
5.4.140.0050.01613.04
5.4.130.0010.02013.20
5.4.120.0020.01813.17
5.4.110.0040.01713.24
5.4.100.0010.02013.07
5.4.90.0060.01613.26
5.4.80.0010.02113.11
5.4.70.0040.01813.24
5.4.60.0070.01313.21
5.4.50.0040.01813.20
5.4.40.0020.01713.15
5.4.30.0020.02013.13
5.4.20.0070.01313.19
5.4.10.0060.01613.12
5.4.00.0020.02012.97
5.3.290.0080.02712.35
5.3.280.0040.02612.41
5.3.270.0070.01412.43
5.3.260.0060.01712.44
5.3.250.0030.01912.42
5.3.240.0060.02012.29
5.3.230.0030.01912.34
5.3.220.0050.01512.39
5.3.210.0050.01612.39
5.3.200.0030.01812.37
5.3.190.0070.01412.35
5.3.180.0070.01512.48
5.3.170.0070.01512.38
5.3.160.0010.01912.46
5.3.150.0040.01912.39
5.3.140.0030.01812.50
5.3.130.0070.01712.34
5.3.120.0050.01412.38
5.3.110.0050.01712.35
5.3.100.0040.01612.11
5.3.90.0060.01612.25
5.3.80.0060.01312.16
5.3.70.0060.01612.14
5.3.60.0030.01712.21
5.3.50.0090.01412.23
5.3.40.0050.01712.17
5.3.30.0050.01312.23
5.3.20.0070.01312.05
5.3.10.0050.01611.99
5.3.00.0050.01711.98
5.2.170.0030.03012.44
5.2.160.0030.02312.44
5.2.150.0000.03012.44
5.2.140.0030.02312.44
5.2.130.0030.02312.44
5.2.120.0030.03012.44
5.2.110.0030.02712.44
5.2.100.0100.01712.44
5.2.90.0070.02312.44
5.2.80.0070.03012.44
5.2.70.0000.03312.44
5.2.60.0030.03012.44
5.2.50.0000.02712.44
5.2.40.0030.02312.44
5.2.30.0070.02712.44
5.2.20.0030.02312.44
5.2.10.0030.02312.44
5.2.00.0030.02012.44
5.1.60.0000.02012.44
5.1.50.0000.02012.44
5.1.40.0000.02012.44
5.1.30.0000.02312.44
5.1.20.0000.02312.44
5.1.10.0000.02312.44
5.1.00.0030.02012.44
5.0.50.0000.01712.44
5.0.40.0000.01712.44
5.0.30.0030.02312.44
5.0.20.0030.01712.44
5.0.10.0000.01712.44
5.0.00.0070.02312.44
4.4.90.0000.02312.44
4.4.80.0000.01712.44
4.4.70.0030.01312.44
4.4.60.0000.01712.44
4.4.50.0030.01712.44
4.4.40.0000.02012.44
4.4.30.0000.01312.44
4.4.20.0000.01312.44
4.4.10.0030.01012.44
4.4.00.0070.01712.44
4.3.110.0000.01312.44
4.3.100.0000.01312.44
4.3.90.0030.01312.44
4.3.80.0000.02312.44
4.3.70.0030.01012.44
4.3.60.0000.01312.44
4.3.50.0030.01012.44
4.3.40.0000.02012.44
4.3.30.0000.01312.44
4.3.20.0000.01712.44
4.3.10.0000.01312.44
4.3.00.0000.01312.44

preferences:
35.26 ms | 401 KiB | 5 Q