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 (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); 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.01014.78
7.4.00.0030.01415.00
7.3.130.0100.00714.88
7.3.120.0000.01914.84
7.3.110.0050.01314.79
7.3.100.0030.01014.86
7.3.90.0000.01014.80
7.3.80.0000.00814.90
7.3.70.0000.01115.03
7.3.60.0090.00614.68
7.3.50.0090.00615.06
7.3.40.0040.00415.05
7.3.30.0100.00314.94
7.3.20.0030.01016.71
7.3.10.0120.00416.70
7.3.00.0100.00316.66
7.2.260.0070.01315.11
7.2.250.0080.01115.34
7.2.240.0030.00915.11
7.2.230.0070.01014.96
7.2.220.0080.00615.05
7.2.210.0070.00714.90
7.2.200.0000.01415.04
7.2.190.0070.01115.08
7.2.180.0120.00615.12
7.2.170.0070.00714.87
7.2.160.0000.01515.05
7.2.150.0030.00916.94
7.2.140.0030.01217.02
7.2.130.0060.00916.58
7.2.120.0040.00816.91
7.2.110.0080.00416.64
7.2.100.0030.00916.98
7.2.90.0070.00716.97
7.2.80.0000.01117.02
7.2.70.0030.00717.13
7.2.60.0040.00817.02
7.2.50.0060.00917.03
7.2.40.0030.00617.06
7.2.30.0030.01317.00
7.2.20.0090.00616.78
7.2.10.0050.00517.01
7.2.00.0050.01218.26
7.1.330.0030.01215.79
7.1.320.0100.00615.98
7.1.310.0070.00715.88
7.1.300.0070.01015.81
7.1.290.0070.01115.71
7.1.280.0060.00615.65
7.1.270.0040.01115.89
7.1.260.0000.01015.82
7.1.250.0040.01215.83
7.1.240.0070.00715.61
7.1.230.0040.01115.90
7.1.220.0000.01316.00
7.1.210.0040.01215.58
7.1.200.0040.00415.68
7.1.190.0040.01115.93
7.1.180.0000.01415.94
7.1.170.0120.00315.64
7.1.160.0060.00615.90
7.1.150.0030.01415.96
7.1.140.0060.00315.82
7.1.130.0000.01015.91
7.1.120.0000.01115.86
7.1.110.0030.01015.80
7.1.100.0000.01516.08
7.1.90.0000.01015.95
7.1.80.0100.00315.85
7.1.70.0050.00516.56
7.1.60.0040.00617.59
7.1.50.0070.01016.50
7.1.40.0040.00415.76
7.1.30.0070.00715.83
7.1.20.0070.00715.89
7.1.10.0030.00715.69
7.1.00.0040.03919.09
7.0.330.0030.01015.43
7.0.320.0100.00715.50
7.0.310.0070.00715.46
7.0.300.0100.00015.32
7.0.290.0060.00915.32
7.0.280.0100.00415.49
7.0.270.0060.00915.36
7.0.260.0110.00415.18
7.0.250.0060.01015.50
7.0.240.0090.00615.12
7.0.230.0060.00915.31
7.0.220.0100.00315.39
7.0.210.0030.00715.25
7.0.200.0360.00515.88
7.0.190.0130.00015.44
7.0.180.0030.01015.23
7.0.170.0040.00415.48
7.0.160.0110.00415.23
7.0.150.0100.00015.51
7.0.140.0020.04118.59
7.0.130.0070.00715.22
7.0.120.0060.00615.29
7.0.110.0070.00315.24
7.0.100.0230.04017.80
7.0.90.0330.04017.68
7.0.80.0230.03417.74
7.0.70.0300.04017.78
7.0.60.0380.03817.80
7.0.50.0300.04317.85
7.0.40.0120.03716.80
7.0.30.0060.04816.71
7.0.20.0110.04216.79
7.0.10.0050.04516.78
7.0.00.0060.03216.75
5.6.400.0110.00414.16
5.6.390.0030.00914.88
5.6.380.0040.01114.53
5.6.370.0030.01014.27
5.6.360.0120.00414.19
5.6.350.0040.01514.52
5.6.340.0000.01314.83
5.6.330.0060.00914.43
5.6.320.0070.00714.72
5.6.310.0060.00614.80
5.6.300.0000.01214.70
5.6.290.0080.00914.60
5.6.280.0080.03717.66
5.6.270.0060.00914.31
5.6.260.0040.00814.63
5.6.250.0070.04317.45
5.6.240.0070.04317.48
5.6.230.0080.03017.57
5.6.220.0080.04017.53
5.6.210.0080.04317.58
5.6.200.0090.04017.86
5.6.190.0030.04817.83
5.6.180.0080.04417.77
5.6.170.0100.03817.76
5.6.160.0050.04517.68
5.6.150.0080.03817.91
5.6.140.0030.04317.74
5.6.130.0030.02817.68
5.6.120.0090.04417.78
5.6.110.0100.04317.91
5.6.100.0040.04117.74
5.6.90.0080.04517.72
5.6.80.0080.04217.60
5.6.70.0070.04417.32
5.6.60.0070.04317.38
5.6.50.0070.02617.33
5.6.40.0080.04117.51
5.6.30.0050.03717.48
5.6.20.0080.04317.41
5.6.10.0070.03017.46
5.6.00.0090.03617.28
5.5.380.0130.03717.58
5.5.370.0080.04017.51
5.5.360.0050.04017.49
5.5.350.0090.04217.57
5.5.340.0030.03317.58
5.5.330.0030.03017.78
5.5.320.0070.04117.63
5.5.310.0100.03917.56
5.5.300.0020.04517.82
5.5.290.0070.04317.80
5.5.280.0080.04017.66
5.5.270.0070.04517.85
5.5.260.0050.04717.55
5.5.250.0100.04017.60
5.5.240.0100.04017.41
5.5.230.0030.04517.25
5.5.220.0050.03317.20
5.5.210.0110.03617.33
5.5.200.0030.04417.35
5.5.190.0120.04017.34
5.5.180.0020.04817.41
5.5.170.0070.01014.67
5.5.160.0000.04817.25
5.5.150.0030.03017.43
5.5.140.0070.04417.32
5.5.130.0060.04817.11
5.5.120.0030.04717.37
5.5.110.0130.03817.37
5.5.100.0110.03617.27
5.5.90.0140.03317.12
5.5.80.0030.03117.41
5.5.70.0050.04517.11
5.5.60.0100.03917.20
5.5.50.0070.03517.21
5.5.40.0040.04417.12
5.5.30.0080.03817.23
5.5.20.0120.04217.25
5.5.10.0030.03017.17
5.5.00.0120.02717.12
5.4.450.0020.05116.18
5.4.440.0030.04316.15
5.4.430.0070.04216.24
5.4.420.0090.03916.25
5.4.410.0030.04516.19
5.4.400.0070.02716.13
5.4.390.0130.03516.11
5.4.380.0090.03816.02
5.4.370.0030.04416.04
5.4.360.0050.04816.02
5.4.350.0070.04316.06
5.4.340.0070.04216.08
5.4.330.0030.00813.13
5.4.320.0040.02515.99
5.4.310.0060.03816.18
5.4.300.0100.03816.17
5.4.290.0070.04016.08
5.4.280.0080.03916.01
5.4.270.0040.03316.01
5.4.260.0010.04216.09
5.4.250.0070.03716.08
5.4.240.0050.04216.13
5.4.230.0060.04115.99
5.4.220.0060.04116.08
5.4.210.0000.03716.13
5.4.200.0070.03916.14
5.4.190.0050.02616.12
5.4.180.0070.03816.13
5.4.170.0120.03816.00
5.4.160.0020.04616.07
5.4.150.0080.03716.03
5.4.140.0090.03614.72
5.4.130.0050.02314.82
5.4.120.0070.02514.84
5.4.110.0070.03714.84
5.4.100.0050.02514.85
5.4.90.0030.04314.85
5.4.80.0060.03914.78
5.4.70.0100.03414.82
5.4.60.0050.04014.76
5.4.50.0120.03314.73
5.4.40.0070.02814.81
5.4.30.0120.02814.83
5.4.20.0050.02414.76
5.4.10.0030.04314.75
5.4.00.0080.03614.53
5.3.290.0080.03813.96
5.3.280.0070.04013.91
5.3.270.0120.01713.89
5.3.260.0030.04013.95
5.3.250.0080.03913.89
5.3.240.0070.03513.87
5.3.230.0040.03813.88
5.3.220.0030.02813.84
5.3.210.0070.02513.91
5.3.200.0050.04013.89
5.3.190.0050.04113.84
5.3.180.0080.04213.91
5.3.170.0100.03813.87
5.3.160.0070.02313.91
5.3.150.0030.04313.89
5.3.140.0080.03613.92
5.3.130.0070.03813.89
5.3.120.0040.03113.94
5.3.110.0060.03813.91
5.3.100.0050.04113.58
5.3.90.0030.03613.63
5.3.80.0030.03813.62
5.3.70.0050.03013.61
5.3.60.0030.04213.63
5.3.50.0060.03513.57
5.3.40.0060.04413.56
5.3.30.0070.03713.55
5.3.20.0030.03913.49
5.3.10.0050.03013.38
5.3.00.0020.03713.41
5.2.170.0070.06011.48
5.2.160.0100.05711.48
5.2.150.0070.05311.48
5.2.140.0030.06711.48
5.2.130.0030.03711.48
5.2.120.0030.06011.48
5.2.110.0030.06311.48
5.2.100.0030.06311.48
5.2.90.0100.05311.48
5.2.80.0030.05311.48
5.2.70.0100.03011.48
5.2.60.0100.06011.48
5.2.50.0070.06011.48
5.2.40.0100.03311.48
5.2.30.0030.05011.48
5.2.20.0000.06311.48
5.2.10.0030.05311.48
5.2.00.0030.06311.48
5.1.60.0070.04311.48
5.1.50.0100.05011.48
5.1.40.0030.05311.48
5.1.30.0070.05011.48
5.1.20.0000.05711.48
5.1.10.0070.05711.48
5.1.00.0000.05711.48
5.0.50.0030.04711.48
5.0.40.0030.04311.48
5.0.30.0000.06311.48
5.0.20.0070.04011.48
5.0.10.0030.04311.48
5.0.00.0000.06711.48
4.4.90.0030.03311.48
4.4.80.0100.02311.48
4.4.70.0000.02711.48
4.4.60.0030.03711.48
4.4.50.0000.03711.48
4.4.40.0030.05011.48
4.4.30.0100.02711.48
4.4.20.0030.01711.48
4.4.10.0030.03311.48
4.4.00.0000.05011.48
4.3.110.0030.02011.48
4.3.100.0030.03711.48
4.3.90.0030.03311.48
4.3.80.0000.05711.48
4.3.70.0030.03311.48
4.3.60.0100.02711.48
4.3.50.0030.03311.48
4.3.40.0030.03711.48
4.3.30.0000.03311.48
4.3.20.0000.02011.48
4.3.10.0030.01711.48
4.3.00.0030.01711.48

preferences:
44.34 ms | 400 KiB | 5 Q