3v4l.org

run code in 300+ PHP versions simultaneously
<?php $classmap1 = array(); for ($i=1; $i<=50000; $i++) { $classmap1['a'.$i] = $i+1; } $classmap2 = array(); for ($i=1; $i<=50000; $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.0470.02828.28
7.3.00.0380.02728.60
7.2.130.0420.02128.30
7.2.120.0320.02229.15
7.2.110.0350.03229.13
7.2.100.0350.02929.13
7.2.90.0430.02028.93
7.2.80.0320.02828.28
7.2.70.0420.03628.98
7.2.60.0430.03428.96
7.2.50.0400.03429.09
7.2.40.0290.03529.08
7.2.30.0410.02829.01
7.2.20.0290.03228.92
7.2.10.0630.01929.10
7.2.00.0200.03130.33
7.1.250.0270.03627.68
7.1.70.0120.01229.06
7.1.60.0170.03429.60
7.1.50.0000.02529.03
7.1.00.0070.05034.58
7.0.200.0740.02626.10
7.0.140.0030.09334.19
7.0.60.0070.10033.86
7.0.50.0100.07734.27
7.0.40.0070.10330.41
7.0.30.0200.07730.23
7.0.20.0030.08330.31
7.0.10.0070.05030.25
7.0.00.0070.10030.41
5.6.280.0130.13751.31
5.6.210.0100.12750.89
5.6.200.0130.14051.31
5.6.190.0230.13751.32
5.6.180.0130.15051.24
5.6.170.0200.13751.33
5.6.160.0230.13351.32
5.6.150.0200.14051.34
5.6.140.0200.12351.23
5.6.130.0070.14351.30
5.6.120.0170.14051.37
5.6.110.0170.14051.32
5.6.100.0230.12351.38
5.6.90.0200.13351.22
5.6.80.0200.07350.76
5.6.70.0100.14750.75
5.6.60.0230.12050.66
5.6.50.0100.14750.71
5.6.40.0300.12050.60
5.6.30.0170.14050.84
5.6.20.0200.11350.82
5.6.10.0200.14050.69
5.6.00.0130.14050.71
5.5.350.0100.14050.84
5.5.340.0100.13750.98
5.5.330.0170.13751.03
5.5.320.0100.13751.11
5.5.310.0300.10051.02
5.5.300.0200.14051.14
5.5.290.0130.13351.02
5.5.280.0170.14351.32
5.5.270.0270.12751.13
5.5.260.0200.13751.30
5.5.250.0130.12351.00
5.5.240.0200.10750.46
5.5.230.0300.11050.68
5.5.220.0170.13350.65
5.5.210.0100.14050.50
5.5.200.0270.13050.57
5.5.190.0170.14050.59
5.5.180.0330.12750.37
5.5.160.0000.14750.48
5.5.150.0100.11750.48
5.5.140.0170.13750.43
5.5.130.0030.14050.45
5.5.120.0170.11750.64
5.5.110.0230.11350.55
5.5.100.0200.14050.36
5.5.90.0270.11750.45
5.5.80.0200.13350.44
5.5.70.0200.11050.31
5.5.60.0030.15050.46
5.5.50.0100.12350.45
5.5.40.0070.15750.31
5.5.30.0330.12350.30
5.5.20.0130.09350.45
5.5.10.0230.12750.31
5.5.00.0300.12750.24
5.4.450.0070.13349.49
5.4.440.0200.13749.52
5.4.430.0200.14349.66
5.4.420.0130.15049.52
5.4.410.0170.13049.48
5.4.400.0300.11749.50
5.4.390.0170.13749.31
5.4.380.0100.14049.20
5.4.370.0100.13349.31
5.4.360.0230.11749.40
5.4.350.0230.13049.32
5.4.340.0230.13349.19
5.4.320.0130.10049.19
5.4.310.0170.13749.22
5.4.300.0070.13349.20
5.4.290.0230.12749.18
5.4.280.0230.12349.21
5.4.270.0200.13349.35
5.4.260.0100.14749.21
5.4.250.0170.12349.29
5.4.240.0200.13349.27
5.4.230.0100.10049.31
5.4.220.0270.12749.29
5.4.210.0130.14349.20
5.4.200.0230.12749.33
5.4.190.0070.14049.19
5.4.180.0270.11749.18
5.4.170.0070.09049.29
5.4.160.0030.15349.32
5.4.150.0270.11349.31
5.4.140.0070.08346.77
5.4.130.0100.14046.52
5.4.120.0170.12746.74
5.4.110.0130.13346.64
5.4.100.0200.12346.60
5.4.90.0200.12746.72
5.4.80.0070.15046.61
5.4.70.0270.12346.70
5.4.60.0270.12346.66
5.4.50.0300.11346.67
5.4.40.0130.13046.64
5.4.30.0100.12746.72
5.4.20.0130.10746.71
5.4.10.0270.12746.75
5.4.00.0170.10746.19
5.3.290.0200.13744.41
5.3.280.0000.10744.45
5.3.270.0170.09744.36
5.3.260.0230.13044.39
5.3.250.0130.09344.25
5.3.240.0100.14344.25
5.3.230.0200.13344.29
5.3.220.0100.14344.31
5.3.210.0230.13744.42
5.3.200.0200.14044.44
5.3.190.0270.13344.41
5.3.180.0030.14744.35
5.3.170.0130.11344.36
5.3.160.0230.10344.38
5.3.150.0200.13744.45
5.3.140.0100.14044.26
5.3.130.0200.13044.25
5.3.120.0230.13044.34
5.3.110.0200.13344.39
5.3.100.0200.09043.89
5.3.90.0170.13743.81
5.3.80.0130.14343.59
5.3.70.0230.13043.66
5.3.60.0170.13743.78
5.3.50.0130.12043.71
5.3.40.0070.11743.66
5.3.30.0270.10043.59
5.3.20.0270.13343.46
5.3.10.0100.08043.29
5.3.00.0030.09343.36
5.2.170.0030.03711.15
5.2.160.0000.04711.01
5.2.150.0030.06011.23
5.2.140.0030.04711.05
5.2.130.0000.04011.16
5.2.120.0000.03011.21
5.2.110.0000.03711.16
5.2.100.0000.03311.11
5.2.90.0030.04311.19
5.2.80.0030.02711.00
5.2.70.0030.03011.18
5.2.60.0030.02711.05
5.2.50.0000.03011.07
5.2.40.0030.02711.05
5.2.30.0000.03011.04
5.2.20.0000.03010.92
5.2.10.0000.02710.86
5.2.00.0000.02710.80
5.1.60.0030.02010.32
5.1.50.0000.02010.32
5.1.40.0000.02710.32
5.1.30.0030.02310.32
5.1.20.0000.03310.34
5.1.10.0000.02310.32
5.1.00.0000.02010.32
5.0.50.0000.02010.32
5.0.40.0030.02010.32
5.0.30.0070.02010.32
5.0.20.0000.02010.32
5.0.10.0030.01710.32
5.0.00.0030.02710.32
4.4.90.0000.01710.32
4.4.80.0000.02010.32
4.4.70.0000.01710.32
4.4.60.0000.01310.32
4.4.50.0000.01710.32
4.4.40.0000.02310.32
4.4.30.0000.01710.32
4.4.20.0000.02010.32
4.4.10.0000.01310.32
4.4.00.0000.02010.32
4.3.110.0000.01710.32
4.3.100.0000.01710.32
4.3.90.0000.01310.32
4.3.80.0000.02010.32
4.3.70.0000.01310.32
4.3.60.0030.01310.32
4.3.50.0000.01710.32
4.3.40.0000.02010.32
4.3.30.0030.01010.32
4.3.20.0000.01310.32
4.3.10.0030.01010.32
4.3.00.0000.01310.32

preferences:
39.77 ms | 401 KiB | 5 Q