3v4l.org

run code in 300+ PHP versions simultaneously
<?php $classmap1 = array(); for ($i=1; $i<=5000; $i++) { $classmap1['a'.$i] = $i+1; } $classmap2 = array(); for ($i=1; $i<=5000; $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]) || $a['foo'] === null) { 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.0080.00416.70
7.3.00.0070.00716.47
7.2.130.0040.01116.85
7.2.120.0070.00716.96
7.2.110.0000.01416.67
7.2.100.0060.00916.92
7.2.90.0030.01016.54
7.2.80.0000.01316.99
7.2.70.0060.00916.63
7.2.60.0030.01317.08
7.2.50.0190.00016.82
7.2.40.0040.01516.82
7.2.30.0060.00616.91
7.2.20.0070.01017.11
7.2.10.0140.00717.04
7.2.00.0190.00417.00
7.1.250.0090.00615.78
7.1.70.0000.00817.03
7.1.60.0040.00817.20
7.1.50.0120.01217.30
7.1.00.0000.03722.36
7.0.200.0040.01816.69
7.0.140.0000.08022.07
7.0.100.0130.07321.00
7.0.90.0000.05721.08
7.0.80.0070.08320.97
7.0.70.0130.08021.07
7.0.60.0100.06021.11
7.0.50.0530.05021.41
7.0.40.0130.07320.10
7.0.30.0130.06720.11
7.0.20.0130.07720.08
7.0.10.0200.07020.05
7.0.00.0170.07020.08
5.6.280.0030.07723.53
5.6.250.0170.07323.29
5.6.240.0070.09023.25
5.6.230.0100.08323.19
5.6.220.0100.06723.24
5.6.210.0070.07723.20
5.6.200.0170.07323.60
5.6.190.0000.06023.83
5.6.180.0100.08723.70
5.6.170.0100.08323.66
5.6.160.0100.08723.71
5.6.150.0100.06023.74
5.6.140.0100.07323.76
5.6.130.0100.08723.66
5.6.120.0130.08323.69
5.6.110.0200.05323.73
5.6.100.0170.07323.57
5.6.90.0070.09023.67
5.6.80.0100.08023.04
5.6.70.0070.08322.98
5.6.60.0070.05723.07
5.6.50.0030.08323.20
5.6.40.0100.08323.12
5.6.30.0030.09023.12
5.6.20.0070.08023.01
5.6.10.0030.09323.05
5.6.00.0030.09022.96
5.5.380.0070.08723.05
5.5.370.0130.08323.05
5.5.360.0130.08723.10
5.5.350.0170.07023.05
5.5.340.0130.08323.41
5.5.330.0130.08023.59
5.5.320.0100.06723.43
5.5.310.0000.06323.50
5.5.300.0100.09023.52
5.5.290.0130.05023.52
5.5.280.0130.07723.38
5.5.270.0100.08723.52
5.5.260.0130.08723.44
5.5.250.0070.08723.20
5.5.240.0100.08022.93
5.5.230.0100.05322.67
5.5.220.0130.08322.88
5.5.210.0070.08322.94
5.5.200.0070.08722.77
5.5.190.0100.06322.78
5.5.180.0170.07022.83
5.5.160.0230.03322.83
5.5.150.0070.08022.90
5.5.140.0100.05722.89
5.5.130.0130.08022.88
5.5.120.0030.08722.79
5.5.110.0070.08322.79
5.5.100.0100.07722.70
5.5.90.0130.04022.81
5.5.80.0100.08022.65
5.5.70.0100.08022.58
5.5.60.0170.07022.81
5.5.50.0100.08322.70
5.5.40.0100.06322.79
5.5.30.0100.08022.73
5.5.20.0130.07722.70
5.5.10.0130.07322.60
5.5.00.0100.08022.62
5.4.450.0070.08021.90
5.4.440.0130.07722.03
5.4.430.0000.08021.79
5.4.420.0070.09021.92
5.4.410.0170.07021.81
5.4.400.0100.04021.48
5.4.390.0070.08321.69
5.4.380.0130.07321.57
5.4.370.0100.07321.56
5.4.360.0070.07321.76
5.4.350.0130.07721.43
5.4.340.0130.07321.70
5.4.320.0100.06321.61
5.4.310.0030.08021.63
5.4.300.0000.08321.61
5.4.290.0130.08021.55
5.4.280.0070.07721.59
5.4.270.0030.07321.44
5.4.260.0130.07321.69
5.4.250.0130.07721.46
5.4.240.0070.08321.40
5.4.230.0130.07321.62
5.4.220.0100.06021.68
5.4.210.0070.07721.52
5.4.200.0200.06721.46
5.4.190.0100.07321.61
5.4.180.0000.09321.59
5.4.170.0030.08321.61
5.4.160.0030.08021.51
5.4.150.0030.08721.58
5.4.140.0030.05719.08
5.4.130.0100.08018.96
5.4.120.0070.06018.82
5.4.110.0100.07018.96
5.4.100.0000.05319.04
5.4.90.0100.04318.98
5.4.80.0100.05719.02
5.4.70.0130.07019.14
5.4.60.0130.07019.03
5.4.50.0130.07019.04
5.4.40.0100.03718.95
5.4.30.0100.05018.89
5.4.20.0070.03718.99
5.4.10.0030.04019.02
5.4.00.0100.03318.38
5.3.290.0130.07717.03
5.3.280.0100.08317.12
5.3.270.0100.07016.97
5.3.260.0100.05717.05
5.3.250.0170.06017.07
5.3.240.0070.08017.13
5.3.230.0070.08317.06
5.3.220.0100.06317.00
5.3.210.0070.06717.02
5.3.200.0170.06317.08
5.3.190.0200.03316.94
5.3.180.0100.08716.96
5.3.170.0100.07317.04
5.3.160.0100.07717.08
5.3.150.0100.08017.07
5.3.140.0070.05316.97
5.3.130.0000.04317.05
5.3.120.0070.05017.06
5.3.110.0070.07716.91
5.3.100.0000.04716.51
5.3.90.0030.04316.38
5.3.80.0100.03316.46
5.3.70.0030.04316.35
5.3.60.0000.04016.29
5.3.50.0100.03316.36
5.3.40.0100.04016.25
5.3.30.0030.06716.27
5.3.20.0030.05316.02
5.3.10.0070.03316.12
5.3.00.0030.03715.93
5.2.170.0030.05714.24
5.2.160.0000.03014.24
5.2.150.0000.05714.24
5.2.140.0000.03014.24
5.2.130.0100.02314.24
5.2.120.0000.03014.24
5.2.110.0030.04714.24
5.2.100.0000.05014.24
5.2.90.0100.02714.24
5.2.80.0000.04714.24
5.2.70.0070.02314.24
5.2.60.0070.05314.24
5.2.50.0000.04714.24
5.2.40.0030.02714.24
5.2.30.0000.03014.24
5.2.20.0070.03314.24
5.2.10.0000.02714.24
5.2.00.0030.02714.24
5.1.60.0070.02014.24
5.1.50.0030.02314.24
5.1.40.0030.02314.24
5.1.30.0030.02314.24
5.1.20.0030.04014.24
5.1.10.0000.02714.24
5.1.00.0000.03014.24
5.0.50.0000.02014.24
5.0.40.0030.01714.24
5.0.30.0000.03014.24
5.0.20.0070.01714.24
5.0.10.0000.02314.24
5.0.00.0030.03014.24
4.4.90.0030.01314.24
4.4.80.0030.02014.24
4.4.70.0000.01714.24
4.4.60.0000.01714.24
4.4.50.0030.01314.24
4.4.40.0000.02714.24
4.4.30.0000.01714.24
4.4.20.0000.01714.24
4.4.10.0000.01714.24
4.4.00.0030.02314.24
4.3.110.0000.02714.24
4.3.100.0000.02014.24
4.3.90.0030.01314.24
4.3.80.0070.03314.24
4.3.70.0000.01714.24
4.3.60.0030.02714.24
4.3.50.0000.01714.24
4.3.40.0030.03014.24
4.3.30.0030.01314.24
4.3.20.0000.02014.24
4.3.10.0030.01714.24
4.3.00.0000.01314.24

preferences:
37.17 ms | 400 KiB | 5 Q