3v4l.org

run code in 300+ PHP versions simultaneously
<?php $classmap1 = array(); for ($i=1; $i<=10000; $i++) { $classmap1['a'.$i] = $i+1; } $classmap2 = array(); for ($i=1; $i<=10000; $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.1.70.0030.00720.94
7.1.60.0170.01421.13
7.1.50.0030.02320.85
7.1.00.0030.07726.31
7.0.200.5510.01318.24
7.0.140.0030.08026.02
7.0.70.0200.03322.76
7.0.60.0130.05022.86
7.0.50.0130.04323.07
7.0.40.0030.04320.05
7.0.30.0100.04320.15
7.0.20.0030.07020.14
7.0.10.0030.03720.06
7.0.00.0070.04319.99
5.6.280.0130.08027.25
5.6.220.0130.04026.68
5.6.210.0100.04326.85
5.6.200.0100.06727.33
5.6.190.0070.07327.21
5.6.180.0030.05327.27
5.6.170.0030.07327.14
5.6.160.0030.04327.25
5.6.150.0030.05027.29
5.6.140.0070.04327.29
5.6.130.0030.09027.27
5.6.120.0070.04327.22
5.6.110.0070.04727.18
5.6.100.0030.05327.11
5.6.90.0100.03727.27
5.6.80.0100.04326.68
5.6.70.0100.09326.61
5.6.60.0270.07326.66
5.6.50.0170.09026.58
5.6.40.0100.10026.59
5.6.30.0200.09026.57
5.6.20.0070.08726.61
5.6.10.0130.08726.62
5.6.00.0200.08726.48
5.5.360.0070.05026.58
5.5.350.0030.05326.55
5.5.340.0070.04727.00
5.5.330.0070.04727.02
5.5.320.0070.04727.11
5.5.310.0070.04726.92
5.5.300.0070.05027.11
5.5.290.0030.05026.95
5.5.280.0030.05026.92
5.5.270.0130.04327.07
5.5.260.0070.06327.01
5.5.250.0070.07026.64
5.5.240.0000.05726.46
5.5.230.0200.08026.21
5.5.220.0100.09326.30
5.5.210.0130.09026.47
5.5.200.0200.06726.28
5.5.190.0030.08726.29
5.5.180.0130.05026.31
5.5.160.0100.10026.18
5.5.150.0170.09026.45
5.5.140.0070.05726.41
5.5.130.0100.09326.34
5.5.120.0070.09326.26
5.5.110.0100.06026.31
5.5.100.0070.08026.30
5.5.90.0130.06726.24
5.5.80.0100.09326.29
5.5.70.0100.09026.25
5.5.60.0100.09326.12
5.5.50.0100.09326.35
5.5.40.0100.09026.14
5.5.30.0100.09026.26
5.5.20.0100.09026.29
5.5.10.0130.08026.14
5.5.00.0170.06326.11
5.4.450.0030.05025.50
5.4.440.0070.06325.30
5.4.430.0030.04725.30
5.4.420.0070.04725.46
5.4.410.0000.05025.36
5.4.400.0100.04025.16
5.4.390.0100.07025.13
5.4.380.0130.08025.30
5.4.370.0100.09025.16
5.4.360.0170.08025.15
5.4.350.0130.06725.33
5.4.340.0230.07725.34
5.4.320.0130.08725.14
5.4.310.0000.10025.18
5.4.300.0070.04725.23
5.4.290.0030.09325.11
5.4.280.0070.09025.14
5.4.270.0030.09325.12
5.4.260.0130.07725.04
5.4.250.0070.05025.14
5.4.240.0070.09725.11
5.4.230.0030.09725.15
5.4.220.0170.08025.15
5.4.210.0130.08725.25
5.4.200.0130.09025.23
5.4.190.0170.08325.30
5.4.180.0130.08025.32
5.4.170.0000.05725.15
5.4.160.0200.07025.18
5.4.150.0200.06724.96
5.4.140.0100.08322.53
5.4.130.0100.08022.52
5.4.120.0130.07322.52
5.4.110.0100.08322.52
5.4.100.0070.04322.49
5.4.90.0030.10022.49
5.4.80.0130.07722.61
5.4.70.0130.08722.46
5.4.60.0100.08722.52
5.4.50.0100.08722.64
5.4.40.0070.09322.45
5.4.30.0030.08022.61
5.4.20.0070.08322.52
5.4.10.0100.06322.61
5.4.00.0030.09321.89
5.3.290.0100.09320.54
5.3.280.0170.08020.44
5.3.270.0030.09320.34
5.3.260.0130.09020.44
5.3.250.0100.08720.41
5.3.240.0100.08020.34
5.3.230.0170.08020.34
5.3.220.0130.05020.42
5.3.210.0130.06020.27
5.3.200.0070.04720.30
5.3.190.0170.05320.33
5.3.180.0030.06720.29
5.3.170.0030.06020.51
5.3.160.0070.05320.36
5.3.150.0130.08320.47
5.3.140.0170.09020.76
5.3.130.0000.10020.39
5.3.120.0100.09720.25
5.3.110.0130.08020.25
5.3.100.0170.07319.77
5.3.90.0030.07319.78
5.3.80.0030.07019.64
5.3.70.0200.08719.69
5.3.60.0030.09319.72
5.3.50.0230.08319.61
5.3.40.0130.03719.71
5.3.30.0130.05019.70
5.3.20.0200.06019.36
5.3.10.0070.08019.46
5.3.00.0100.09019.34
5.2.170.0100.02311.20
5.2.160.0070.02711.05
5.2.150.0030.06011.26
5.2.140.0000.03311.25
5.2.130.0000.03711.13
5.2.120.0000.03311.12
5.2.110.0030.02710.97
5.2.100.0030.06011.20
5.2.90.0000.04011.00
5.2.80.0030.06711.12
5.2.70.0070.02311.19
5.2.60.0030.04011.12
5.2.50.0030.06311.09
5.2.40.0030.04311.05
5.2.30.0030.06310.87
5.2.20.0070.04711.02
5.2.10.0170.05310.88
5.2.00.0030.05710.83
5.1.60.0070.05310.46
5.1.50.0000.05010.46
5.1.40.0030.03310.46
5.1.30.0000.06010.46
5.1.20.0030.04710.46
5.1.10.0100.05310.46
5.1.00.0070.02710.46
5.0.50.0000.05010.46
5.0.40.0030.04010.46
5.0.30.0030.05310.46
5.0.20.0030.04310.46
5.0.10.0000.04010.46
5.0.00.0000.07310.46
4.4.90.0030.03710.46
4.4.80.0070.03310.46
4.4.70.0030.03710.46
4.4.60.0070.03310.46
4.4.50.0070.02010.46
4.4.40.0000.04010.46
4.4.30.0000.03310.46
4.4.20.0000.02010.46
4.4.10.0000.04010.46
4.4.00.0030.04310.46
4.3.110.0030.03310.46
4.3.100.0000.03710.46
4.3.90.0000.02710.46
4.3.80.0070.04710.46
4.3.70.0000.03710.46
4.3.60.0070.03310.46
4.3.50.0030.02710.46
4.3.40.0030.05310.46
4.3.30.0070.03310.46
4.3.20.0000.03710.46
4.3.10.0070.03010.46
4.3.00.0030.02710.46

preferences:
30.5 ms | 400 KiB | 5 Q