3v4l.org

run code in 300+ PHP versions simultaneously
<?php $classmap1 = array(); for ($i=1; $i<=500; $i++) { $classmap1['a'.$i] = $i+1; } $classmap2 = array(); for ($i=1; $i<=500; $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.10.0060.00616.55
7.3.00.0030.01016.28
7.2.130.0060.00616.65
7.2.120.0090.00016.65
7.2.110.0000.01416.65
7.2.100.0100.00016.26
7.2.90.0070.00316.36
7.2.80.0060.00616.35
7.2.70.0080.00416.80
7.2.60.0040.00916.86
7.2.50.0060.00916.95
7.2.40.0060.00616.42
7.2.30.0060.01016.82
7.2.20.0000.01116.67
7.2.10.0030.00816.83
7.2.00.0030.01018.38
7.1.250.0000.00915.80
7.1.70.0000.00817.25
7.1.60.0070.01719.32
7.1.50.0070.01516.98
7.1.00.0100.07022.40
7.0.200.0210.00616.55
7.0.140.0030.07322.00
7.0.100.0070.04720.14
7.0.90.0100.08020.05
7.0.80.0170.04720.07
7.0.70.0170.04320.04
7.0.60.0130.07720.18
7.0.50.0100.07720.50
7.0.40.0100.07720.17
7.0.30.0000.06020.02
7.0.20.0000.05720.07
7.0.10.0100.07020.13
7.0.00.0030.07320.06
5.6.280.0030.07321.35
5.6.250.0130.08321.04
5.6.240.0170.10020.95
5.6.230.0070.07320.79
5.6.220.0000.05320.78
5.6.210.0170.08021.03
5.6.200.0030.09021.41
5.6.190.0070.08321.25
5.6.180.0070.07721.36
5.6.170.0100.07321.21
5.6.160.0070.09021.31
5.6.150.0230.05721.41
5.6.140.0030.06321.44
5.6.130.0200.07321.41
5.6.120.0070.07721.32
5.6.110.0170.04721.22
5.6.100.0070.08721.31
5.6.90.0130.07721.26
5.6.80.0000.05320.60
5.6.70.0000.04320.73
5.6.60.0100.03720.68
5.6.50.0030.04320.80
5.6.40.0070.03720.58
5.6.30.0130.04020.68
5.6.20.0000.04320.73
5.6.10.0030.04320.64
5.6.00.0070.03720.63
5.5.380.0130.05320.64
5.5.370.0170.06720.86
5.5.360.0070.06320.64
5.5.350.0070.05720.66
5.5.340.0170.06721.18
5.5.330.0130.08021.07
5.5.320.0100.07321.17
5.5.310.0200.07020.90
5.5.300.0100.08021.19
5.5.290.0130.08021.16
5.5.280.0200.07021.16
5.5.270.0230.06720.99
5.5.260.0070.08721.14
5.5.250.0170.06320.88
5.5.240.0100.07320.50
5.5.230.0000.04720.54
5.5.220.0030.04320.51
5.5.210.0030.04320.55
5.5.200.0100.03720.36
5.5.190.0070.04020.54
5.5.180.0070.03720.40
5.5.160.0000.04720.45
5.5.150.0000.05020.43
5.5.140.0070.03720.54
5.5.130.0070.08020.41
5.5.120.0070.04320.38
5.5.110.0100.04020.35
5.5.100.0100.04020.34
5.5.90.0030.04020.22
5.5.80.0070.03720.44
5.5.70.0070.04020.42
5.5.60.0070.03720.34
5.5.50.0000.07020.33
5.5.40.0100.03720.32
5.5.30.0030.04320.40
5.5.20.0070.04320.34
5.5.10.0030.04320.39
5.5.00.0000.04320.32
5.4.450.0130.07319.58
5.4.440.0030.08719.59
5.4.430.0070.08319.64
5.4.420.0070.07319.72
5.4.410.0270.05719.45
5.4.400.0070.06019.11
5.4.390.0030.04719.25
5.4.380.0070.03719.31
5.4.370.0030.04019.30
5.4.360.0030.04319.08
5.4.350.0100.03719.34
5.4.340.0030.04019.24
5.4.320.0100.03319.46
5.4.310.0030.03019.40
5.4.300.0070.07019.39
5.4.290.0100.07319.11
5.4.280.0070.04019.25
5.4.270.0070.03719.33
5.4.260.0070.04319.34
5.4.250.0070.04019.11
5.4.240.0000.06319.07
5.4.230.0070.03719.25
5.4.220.0030.04019.11
5.4.210.0100.03319.39
5.4.200.0030.04319.32
5.4.190.0070.04019.11
5.4.180.0070.04019.21
5.4.170.0030.04019.13
5.4.160.0000.04019.12
5.4.150.0000.03319.09
5.4.140.0100.03316.54
5.4.130.0000.03316.55
5.4.120.0070.03716.55
5.4.110.0030.03716.76
5.4.100.0030.03716.56
5.4.90.0070.03316.71
5.4.80.0070.03716.54
5.4.70.0000.03716.63
5.4.60.0070.03316.62
5.4.50.0000.04716.56
5.4.40.0030.03316.58
5.4.30.0030.03316.59
5.4.20.0070.03016.66
5.4.10.0000.03716.62
5.4.00.0000.03716.13
5.3.290.0000.03714.86
5.3.280.0000.04315.03
5.3.270.0030.04014.96
5.3.260.0030.04015.04
5.3.250.0100.03015.01
5.3.240.0000.04314.96
5.3.230.0000.04314.89
5.3.220.0000.03314.97
5.3.210.0000.03714.81
5.3.200.0030.04315.02
5.3.190.0030.04014.83
5.3.180.0000.04714.96
5.3.170.0130.03314.86
5.3.160.0070.04714.95
5.3.150.0070.03314.91
5.3.140.0000.03714.90
5.3.130.0030.04314.89
5.3.120.0000.03714.96
5.3.110.0030.04014.93
5.3.100.0100.06714.43
5.3.90.0130.04714.37
5.3.80.0100.08314.40
5.3.70.0070.07014.31
5.3.60.0030.05714.40
5.3.50.0070.06014.38
5.3.40.0030.06314.30
5.3.30.0030.04014.23
5.3.20.0030.03714.10
5.3.10.0030.07714.03
5.3.00.0030.07713.86
5.2.170.0070.06011.14
5.2.160.0070.05711.21
5.2.150.0030.05311.13
5.2.140.0070.03311.16
5.2.130.0070.05011.17
5.2.120.0100.05311.09
5.2.110.0030.06311.20
5.2.100.0000.06011.20
5.2.90.0070.05711.22
5.2.80.0070.04311.02
5.2.70.0070.05011.02
5.2.60.0170.05010.91
5.2.50.0030.04011.16
5.2.40.0070.05710.89
5.2.30.0000.06011.04
5.2.20.0130.05311.11
5.2.10.0070.06310.77
5.2.00.0100.03710.68
5.1.60.0100.0479.88
5.1.50.0000.05310.00
5.1.40.0100.04310.00
5.1.30.0030.05010.26
5.1.20.0000.06310.27
5.1.10.0000.0309.96
5.1.00.0100.05310.08
5.0.50.0100.0378.59
5.0.40.0100.0378.59
5.0.30.0000.0438.59
5.0.20.0070.0438.59
5.0.10.0000.0408.59
5.0.00.0000.0508.59
4.4.90.0000.0378.59
4.4.80.0030.0278.59
4.4.70.0000.0308.59
4.4.60.0030.0208.59
4.4.50.0070.0308.59
4.4.40.0030.0438.59
4.4.30.0000.0378.59
4.4.20.0070.0238.59
4.4.10.0130.0108.59
4.4.00.0030.0538.59
4.3.110.0030.0378.59
4.3.100.0030.0178.59
4.3.90.0070.0308.59
4.3.80.0070.0538.59
4.3.70.0000.0278.59
4.3.60.0100.0278.59
4.3.50.0000.0308.59
4.3.40.0000.0378.59
4.3.30.0000.0338.59
4.3.20.0000.0178.59
4.3.10.0000.0208.59
4.3.00.0000.0208.59

preferences:
38.87 ms | 401 KiB | 5 Q