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; } print 1;die; 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; } } } } $startTimeFunc = microtime(true); merging::merge($classmap1, $classmap2); $endTimeFunc = microtime(true); echo "Func took " . (($endTimeFunc - $startTimeFunc)*1000) ." microseconds<br />\n"; //var_dump($am);

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.4.00.0140.01116.60
7.3.120.0080.01616.90
7.3.110.0130.01016.55
7.3.100.0040.01416.87
7.3.90.0110.01116.70
7.3.80.0080.01116.76
7.3.70.0040.01116.98
7.3.60.0060.01316.54
7.3.50.0060.01616.87
7.3.40.0130.00616.88
7.3.30.0120.00916.61
7.3.20.0040.01618.56
7.3.10.0070.01018.79
7.3.00.0070.01118.57
7.2.250.0000.01916.77
7.2.240.0130.01316.80
7.2.230.0070.01716.80
7.2.220.0100.01316.78
7.2.210.0060.01316.93
7.2.200.0040.01116.83
7.2.190.0060.01216.81
7.2.180.0110.01116.89
7.2.170.0070.01317.04
7.2.00.0030.01321.39
7.1.330.0060.01217.95
7.1.320.0040.01117.50
7.1.310.0100.01017.65
7.1.300.0070.01117.85
7.1.290.0120.00617.63
7.1.280.0070.01017.33
7.1.270.0120.00917.74
7.1.260.0000.01817.86
7.1.100.0060.01319.71
7.1.70.0060.00918.96
7.1.60.0100.02019.29
7.1.50.0030.02018.86
7.1.00.0070.07724.45
7.0.200.0060.00318.50
7.0.140.0170.06323.99
7.0.60.0030.07021.65
7.0.50.0030.04319.39
7.0.40.0100.09020.09
7.0.30.0230.05720.45
7.0.20.0370.06720.09
7.0.10.0030.05320.08
7.0.00.0100.06320.07
5.6.280.0000.08723.70
5.6.210.0130.06323.34
5.6.200.0100.06320.96
5.6.190.0100.08323.18
5.6.180.0200.07023.18
5.6.170.0230.08723.31
5.6.160.0100.04023.19
5.6.150.0070.07020.93
5.6.140.0030.09321.01
5.6.130.0070.05721.06
5.6.120.0030.04723.99
5.6.110.0100.08323.85
5.6.100.0100.06323.81
5.6.90.0070.09323.71
5.6.80.0030.07323.35
5.5.350.0070.03323.25
5.5.340.0030.05320.83
5.5.330.0030.09322.98
5.5.320.0400.07723.07
5.5.310.0130.04722.80
5.5.300.0170.07720.86
5.5.290.0100.09020.83
5.5.280.0130.08323.61
5.5.270.0070.07323.60
5.5.260.0070.04323.63
5.5.250.0170.09323.30
5.5.240.0100.03023.12
5.4.450.0970.04322.18
5.4.440.0530.06022.17
5.4.430.0770.05322.19
5.4.420.1330.04322.09
5.4.410.0500.04022.20
5.4.400.1430.02021.84
5.4.390.1170.05021.62
5.4.380.0470.05321.39
5.4.370.0330.06021.35
5.4.360.0570.06721.36
5.4.350.0430.07021.57
5.4.340.0400.05321.52
5.4.320.0050.04315.33
5.4.310.0080.04315.33
5.4.300.0080.04615.33
5.4.290.0090.04915.33
5.4.280.0040.04815.23
5.4.270.0100.03915.23
5.4.260.0070.05015.23
5.4.250.0090.04015.23
5.4.240.0410.13315.21
5.4.230.0430.10115.20
5.4.220.0600.13815.20
5.4.210.0270.04715.20
5.4.200.0330.10515.20
5.4.190.0150.06415.20
5.4.180.0250.04715.20
5.4.170.0200.05215.20
5.4.160.0190.05215.20
5.4.150.0590.14215.20
5.4.140.0390.10014.88
5.4.130.0200.05814.87
5.4.120.0500.10214.82
5.4.110.0250.04614.82
5.4.100.0460.14314.82
5.4.90.0430.08614.82
5.4.80.0220.05014.82
5.4.70.0630.12914.82
5.4.60.0310.10014.82
5.4.50.0150.05714.82
5.4.40.0350.09614.80
5.4.30.0200.05114.80
5.4.20.0220.05814.80
5.4.10.0460.15314.80
5.4.00.0130.05714.29
5.3.290.0050.05415.70
5.3.280.0580.16415.61
5.3.270.0170.05515.62
5.3.260.0260.07815.62
5.3.250.0390.09615.62
5.3.240.0340.09715.62
5.3.230.0340.13915.61
5.3.220.0600.19115.58
5.3.210.0840.08415.57
5.3.200.0210.05215.57
5.3.190.0260.07615.58
5.3.180.0210.05115.57
5.3.170.0430.11915.57
5.3.160.0280.10215.57
5.3.150.0500.10915.57
5.3.140.0420.15115.57
5.3.130.0370.09815.56
5.3.120.0550.14215.56
5.3.110.0390.12515.56
5.3.100.0280.10415.05
5.3.90.0230.05515.03
5.3.80.0380.09815.02
5.3.70.0410.12515.02
5.3.60.0180.05915.00
5.3.50.0210.05314.95
5.3.40.0170.05614.95
5.3.30.0850.05514.91
5.3.20.0330.09714.69
5.3.10.0320.09814.65
5.3.00.0190.05214.64
5.2.170.0190.0609.19
5.2.160.0150.0339.20
5.2.150.0420.0689.19
5.2.140.0310.0859.19
5.2.130.0170.0379.15
5.2.120.0120.0359.15
5.2.110.0100.0399.15
5.2.100.0150.0389.16
5.2.90.0290.0809.15
5.2.80.0130.0369.15
5.2.70.0150.0399.15
5.2.60.0070.0409.10
5.2.50.0120.0359.08
5.2.40.0150.0389.05
5.2.30.0270.0799.01
5.2.20.0200.0359.02
5.2.10.0110.0408.92
5.2.00.0230.0848.77
5.1.60.0520.1108.07
5.1.50.0140.0298.06
5.1.40.0220.0798.05
5.1.30.0260.0788.39
5.1.20.0140.0298.42
5.1.10.0250.0388.14
5.1.00.0160.0328.14
5.0.50.0360.0616.62
5.0.40.0060.0266.47
5.0.30.0180.0896.29
5.0.20.0300.0656.25
5.0.10.0090.0236.23
5.0.00.0150.0636.22
4.4.90.0320.0544.78
4.4.80.0080.0184.75
4.4.70.0090.0214.75
4.4.60.0110.0164.75
4.4.50.0320.0554.77
4.4.40.0090.0274.71
4.4.30.0090.0174.76
4.4.20.0100.0184.84
4.4.10.0100.0164.84
4.4.00.0080.0294.76
4.3.110.0050.0214.67
4.3.100.0060.0184.67
4.3.90.0100.0154.63
4.3.80.0210.0784.58
4.3.70.0080.0184.63
4.3.60.0080.0194.63
4.3.50.0060.0254.62
4.3.40.0090.0304.54
4.3.30.0040.0193.28
4.3.20.0090.0183.26
4.3.10.0060.0183.22
4.3.00.0130.01313.14

preferences:
35.95 ms | 401 KiB | 5 Q