3v4l.org

run code in 300+ PHP versions simultaneously
<?php $classmap1 = array(); for ($i=1; $i<=1000; $i++) { $classmap1['a'.$i] = $i+1; } $classmap2 = array(); for ($i=1; $i<=1000; $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.3.120.0070.01015.16
7.3.110.0000.01815.22
7.3.100.0080.00315.23
7.3.90.0100.00715.21
7.3.80.0000.01814.79
7.3.70.0030.01214.96
7.3.60.0100.00615.07
7.3.50.0070.00415.23
7.3.40.0070.01014.97
7.3.30.0060.01015.25
7.3.20.0000.01616.80
7.3.10.0090.00916.71
7.3.00.0070.00416.89
7.2.240.0130.00315.41
7.2.230.0070.01015.55
7.2.220.0090.00915.56
7.2.210.0040.01115.12
7.2.200.0000.01815.46
7.2.190.0030.01415.23
7.2.180.0000.01415.28
7.2.170.0100.01015.11
7.2.160.0060.01215.32
7.2.150.0150.00316.68
7.2.140.0090.00916.82
7.2.130.0070.01016.68
7.2.120.0070.01116.85
7.2.110.0060.00616.95
7.2.100.0060.00616.98
7.2.90.0070.00717.05
7.2.80.0080.01217.04
7.2.70.0090.00917.04
7.2.60.0070.00316.91
7.2.50.0030.01316.78
7.2.40.0060.00917.04
7.2.30.0030.01217.09
7.2.20.0100.00316.79
7.2.10.0060.00616.95
7.2.00.0050.01018.19
7.1.330.0030.00615.61
7.1.320.0050.00515.95
7.1.310.0060.01215.82
7.1.300.0070.00715.96
7.1.290.0100.00715.77
7.1.280.0030.01215.91
7.1.270.0030.01015.53
7.1.260.0090.00615.89
7.1.250.0090.00615.55
7.1.70.0000.00817.10
7.1.60.0100.01619.32
7.1.50.0060.01017.04
7.1.00.0100.04322.46
7.0.200.0050.00516.76
7.0.140.0000.07722.12
7.0.110.0030.08721.66
7.0.100.0070.08021.80
7.0.90.0030.06721.66
7.0.80.0030.08321.69
7.0.70.0130.07321.79
7.0.60.0070.07721.37
7.0.50.0070.07721.67
7.0.40.0100.07319.75
7.0.30.0100.07019.63
7.0.20.0030.08719.82
7.0.10.0070.07319.73
7.0.00.0070.08019.79
5.6.280.0070.07321.63
5.6.260.0030.04021.09
5.6.250.0030.08021.15
5.6.240.0000.09321.09
5.6.230.0030.05021.13
5.6.220.0100.05720.93
5.6.210.0070.08321.28
5.6.200.0030.08720.94
5.6.190.0030.08721.08
5.6.180.0130.06721.03
5.6.170.0000.08720.93
5.6.160.0100.08021.08
5.6.150.0030.09021.13
5.6.140.0030.05721.05
5.6.130.0030.07721.17
5.6.120.0030.08021.13
5.6.110.0030.08721.04
5.6.100.0000.08321.11
5.6.90.0130.07321.12
5.6.80.0030.07720.41
5.6.70.0030.08020.39
5.6.60.0030.08020.54
5.6.50.0130.06320.49
5.6.40.0100.04020.68
5.6.30.0070.04320.41
5.6.20.0100.05720.38
5.6.10.0030.07020.45
5.6.00.0100.06720.48
5.5.380.0030.07718.02
5.5.370.0000.04318.10
5.5.360.0030.08718.02
5.5.350.0030.08018.20
5.5.340.0070.07718.63
5.5.330.0030.07718.57
5.5.320.0070.07318.40
5.5.310.0000.08318.65
5.5.300.0070.08018.41
5.5.290.0000.08018.50
5.5.280.0200.05718.50
5.5.270.0100.08018.40
5.5.260.0030.07718.39
5.5.250.0030.09718.42
5.5.240.0070.07017.85
5.5.230.0100.08017.94
5.5.220.0070.07317.83
5.5.210.0070.07717.80
5.5.200.0000.07717.79
5.5.190.0000.07017.68
5.5.180.0000.08017.98
5.5.160.0070.08017.86
5.5.150.0000.08317.67
5.5.140.0130.07017.76
5.5.130.0070.07317.88
5.5.120.0000.06717.96
5.5.110.0030.07717.76
5.5.100.0030.08017.68
5.5.90.0030.07317.59
5.5.80.0070.05317.78
5.5.70.0000.08317.68
5.5.60.0100.07017.67
5.5.50.0030.08017.77
5.5.40.0030.07717.77
5.5.30.0130.06317.67
5.5.20.0030.04317.80
5.5.10.0000.07017.88
5.5.00.0000.08717.87
5.4.450.0030.08319.82
5.4.440.0030.08319.85
5.4.430.0070.07719.67
5.4.420.0030.08719.75
5.4.410.0030.08019.70
5.4.400.0130.06019.60
5.4.390.0070.07319.50
5.4.380.0070.07319.41
5.4.370.0130.06319.46
5.4.360.0000.07319.49
5.4.350.0030.07019.50
5.4.340.0000.08319.37
5.4.320.0100.07019.41
5.4.310.0030.04719.61
5.4.300.0030.04319.68
5.4.290.0070.06719.47
5.4.280.0100.07019.37
5.4.270.0100.07019.35
5.4.260.0070.04319.50
5.4.250.0030.07019.47
5.4.240.0070.07019.36
5.4.230.0030.07719.36
5.4.220.0100.07019.48
5.4.210.0100.07019.56
5.4.200.0100.06719.37
5.4.190.0100.06719.43
5.4.180.0000.07319.56
5.4.170.0030.08019.49
5.4.160.0100.07019.43
5.4.150.0130.06719.39
5.4.140.0030.05316.82
5.4.130.0070.06716.77
5.4.120.0070.05016.96
5.4.110.0030.07316.97
5.4.100.0070.07016.95
5.4.90.0070.06716.97
5.4.80.0070.07316.79
5.4.70.0030.07016.97
5.4.60.0070.07316.88
5.4.50.0030.07316.81
5.4.40.0030.07016.75
5.4.30.0100.06316.88
5.4.20.0070.06716.97
5.4.10.0030.08017.04
5.4.00.0030.07316.45
5.3.290.0070.05015.39
5.3.280.0030.07015.17
5.3.270.0030.07315.33
5.3.260.0030.08015.05
5.3.250.0000.07715.22
5.3.240.0030.07015.05
5.3.230.0000.06315.22
5.3.220.0030.07015.25
5.3.210.0070.07715.17
5.3.200.0100.07015.16
5.3.190.0070.06715.17
5.3.180.0070.06315.14
5.3.170.0030.05015.16
5.3.160.0070.07015.12
5.3.150.0070.07315.11
5.3.140.0100.07015.22
5.3.130.0000.08014.99
5.3.120.0100.06315.16
5.3.110.0000.08715.37
5.3.100.0000.07314.75
5.3.90.0070.04714.64
5.3.80.0000.07314.83
5.3.70.0030.07714.61
5.3.60.0100.06314.73
5.3.50.0100.05714.49
5.3.40.0070.07014.56
5.3.30.0030.07714.56
5.3.20.0000.07014.32
5.3.10.0070.05714.23
5.3.00.0000.08314.23
5.2.170.0030.06011.29
5.2.160.0000.07011.16
5.2.150.0030.05311.28
5.2.140.0030.06711.22
5.2.130.0000.06011.09
5.2.120.0030.05311.08
5.2.110.0000.06011.23
5.2.100.0000.06311.11
5.2.90.0000.05311.12
5.2.80.0000.03711.09
5.2.70.0030.06011.09
5.2.60.0030.06311.28
5.2.50.0000.05011.05
5.2.40.0000.06011.14
5.2.30.0000.05710.93
5.2.20.0000.06010.95
5.2.10.0000.04310.92
5.2.00.0030.04710.86
5.1.60.0030.0509.98
5.1.50.0030.0509.98
5.1.40.0000.04010.06
5.1.30.0000.04310.33
5.1.20.0070.05010.37
5.1.10.0030.05310.03
5.1.00.0070.04710.07
5.0.50.0000.0408.48
5.0.40.0000.0338.49
5.0.30.0030.0608.19
5.0.20.0000.0478.36
5.0.10.0030.0278.42
5.0.00.0070.0608.16
4.4.90.0030.0307.31
4.4.80.0030.0337.31
4.4.70.0030.0307.31
4.4.60.0000.0337.31
4.4.50.0030.0337.31
4.4.40.0030.0507.31
4.4.30.0030.0307.31
4.4.20.0000.0377.31
4.4.10.0000.0337.31
4.4.00.0070.0507.31
4.3.110.0030.0377.31
4.3.100.0070.0277.31
4.3.90.0070.0307.31
4.3.80.0030.0277.31
4.3.70.0030.0337.31
4.3.60.0000.0337.31
4.3.50.0000.0337.31
4.3.40.0000.0537.31
4.3.30.0000.0377.31
4.3.20.0000.0377.31
4.3.10.0030.0337.31
4.3.00.0000.0307.31

preferences:
40.31 ms | 401 KiB | 5 Q