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 (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.2.00.0000.01219.12
7.1.70.0030.00617.06
7.1.60.0100.01419.32
7.1.50.0030.01717.09
7.1.00.0100.06722.51
7.0.200.0070.00016.55
7.0.140.0130.06722.08
7.0.110.0070.04020.23
7.0.100.0130.03320.20
7.0.90.0230.04320.13
7.0.80.0100.08020.13
7.0.70.0070.03720.19
7.0.60.0030.04020.18
7.0.50.0170.03720.14
7.0.40.0000.04719.86
7.0.30.0070.03719.65
7.0.20.0070.03719.65
7.0.10.0000.05319.88
7.0.00.0000.05719.86
5.6.280.0100.07021.61
5.6.260.0030.04321.29
5.6.250.0070.04021.02
5.6.240.0100.03721.11
5.6.230.0130.04321.20
5.6.220.0030.03721.17
5.6.210.0030.05021.08
5.6.200.0100.03721.16
5.6.190.0000.04721.21
5.6.180.0000.04721.11
5.6.170.0070.04021.07
5.6.160.0100.04321.11
5.6.150.0100.03721.16
5.6.140.0030.04021.13
5.6.130.0000.04721.19
5.6.120.0070.03321.34
5.6.110.0000.04721.14
5.6.100.0030.04321.09
5.6.90.0000.04721.15
5.6.80.0030.04720.51
5.6.70.0030.04020.74
5.6.60.0130.03020.52
5.6.50.0030.03720.72
5.6.40.0100.07320.56
5.6.30.0100.06020.53
5.6.20.0130.06720.57
5.6.10.0030.06320.49
5.6.00.0130.06320.57
5.5.380.0070.03717.97
5.5.370.0030.03718.07
5.5.360.0130.06318.05
5.5.350.0030.04018.05
5.5.340.0030.04018.41
5.5.330.0000.04318.62
5.5.320.0000.05018.57
5.5.310.0000.04318.50
5.5.300.0000.04318.53
5.5.290.0070.03318.63
5.5.280.0030.04018.46
5.5.270.0000.03718.64
5.5.260.0070.03718.40
5.5.250.0030.04018.27
5.5.240.0170.06317.80
5.5.230.0030.04317.71
5.5.220.0000.03717.71
5.5.210.0030.04017.99
5.5.200.0070.03717.93
5.5.190.0100.07317.89
5.5.180.0030.07017.76
5.5.160.0030.03717.96
5.5.150.0070.05017.73
5.5.140.0070.06317.68
5.5.130.0030.03717.98
5.5.120.0070.07018.00
5.5.110.0000.06717.99
5.5.100.0030.06317.89
5.5.90.0070.04017.81
5.5.80.0030.03717.90
5.5.70.0000.05317.77
5.5.60.0030.07717.70
5.5.50.0100.06717.67
5.5.40.0070.04317.68
5.5.30.0030.03717.88
5.5.20.0000.04717.88
5.5.10.0000.07017.89
5.5.00.0030.07717.84
5.4.450.0070.03019.85
5.4.440.0030.04019.86
5.4.430.0000.04719.72
5.4.420.0000.04319.78
5.4.410.0100.03320.00
5.4.400.0070.03019.43
5.4.390.0030.04019.41
5.4.380.0100.03319.62
5.4.370.0000.04319.71
5.4.360.0130.03319.44
5.4.350.0030.04719.80
5.4.340.0070.05019.62
5.4.320.0070.08019.71
5.4.310.0030.07019.53
5.4.300.0000.06019.44
5.4.290.0000.04719.43
5.4.280.0070.03719.71
5.4.270.0100.08019.48
5.4.260.0070.03319.53
5.4.250.0100.06019.50
5.4.240.0100.05319.43
5.4.230.0070.04019.52
5.4.220.0130.07319.79
5.4.210.0070.03319.50
5.4.200.0070.05719.59
5.4.190.0030.07719.38
5.4.180.0000.04019.47
5.4.170.0130.04719.39
5.4.160.0070.03719.50
5.4.150.0000.07019.39
5.4.140.0070.07016.81
5.4.130.0130.05016.92
5.4.120.0030.06716.88
5.4.110.0070.03317.05
5.4.100.0070.03316.94
5.4.90.0000.04716.99
5.4.80.0030.03716.88
5.4.70.0000.04016.84
5.4.60.0100.06016.89
5.4.50.0000.06016.78
5.4.40.0000.03717.12
5.4.30.0030.05716.80
5.4.20.0070.03316.83
5.4.10.0100.06716.96
5.4.00.0030.03316.25
5.3.290.0130.08015.12
5.3.280.0100.07315.21
5.3.270.0030.04315.30
5.3.260.0030.05315.21
5.3.250.0030.07015.43
5.3.240.0100.04715.21
5.3.230.0030.04015.20
5.3.220.0100.07315.17
5.3.210.0000.04315.25
5.3.200.0070.04315.20
5.3.190.0000.04315.17
5.3.180.0030.03715.28
5.3.170.0070.03315.23
5.3.160.0130.06315.17
5.3.150.0030.04715.11
5.3.140.0200.06015.16
5.3.130.0030.03715.00
5.3.120.0070.06015.00
5.3.110.0030.07315.12
5.3.100.0070.06014.63
5.3.90.0000.04014.61
5.3.80.0070.04714.63
5.3.70.0000.04014.68
5.3.60.0070.04014.61
5.3.50.0070.07014.76
5.3.40.0070.03714.76
5.3.30.0030.05714.51
5.3.20.0030.06714.30
5.3.10.0070.06314.24
5.3.00.0000.06314.21
5.2.170.0000.04312.16
5.2.160.0000.03712.16
5.2.150.0000.04712.16
5.2.140.0030.04312.16
5.2.130.0030.04012.16
5.2.120.0000.04012.16
5.2.110.0070.04012.16
5.2.100.0070.05312.16
5.2.90.0030.05712.16
5.2.80.0000.05012.16
5.2.70.0000.03012.16
5.2.60.0030.03012.16
5.2.50.0000.03312.16
5.2.40.0030.02712.16
5.2.30.0000.05012.16
5.2.20.0030.06312.16
5.2.10.0070.04712.16
5.2.00.0000.03012.16
5.1.60.0030.04712.16
5.1.50.0030.02312.16
5.1.40.0070.02712.16
5.1.30.0000.03312.16
5.1.20.0000.02712.16
5.1.10.0000.03312.16
5.1.00.0030.05312.16
5.0.50.0070.01712.16
5.0.40.0030.02712.16
5.0.30.0030.05012.16
5.0.20.0030.03712.16
5.0.10.0030.03012.16
5.0.00.0000.03012.16
4.4.90.0030.03012.16
4.4.80.0030.01712.16
4.4.70.0030.02712.16
4.4.60.0000.01312.16
4.4.50.0030.01312.16
4.4.40.0000.02312.16
4.4.30.0000.01312.16
4.4.20.0000.01712.16
4.4.10.0030.01712.16
4.4.00.0030.02312.16
4.3.110.0000.03712.16
4.3.100.0000.03012.16
4.3.90.0030.03712.16
4.3.80.0030.04312.16
4.3.70.0000.02712.16
4.3.60.0000.03012.16
4.3.50.0000.01712.16
4.3.40.0000.02712.16
4.3.30.0000.03312.16
4.3.20.0030.01312.16
4.3.10.0000.01712.16
4.3.00.0000.01312.16

preferences:
26.8 ms | 401 KiB | 5 Q