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 (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.2.00.0090.00921.35
7.1.70.0070.01019.13
7.1.60.0140.01719.32
7.1.50.0090.01818.92
7.1.00.0070.06024.48
7.0.200.0060.00818.86
7.0.140.0030.08023.92
7.0.100.0330.05022.81
7.0.90.0170.08322.54
7.0.80.0130.08322.66
7.0.70.0230.06322.65
7.0.60.0330.08722.74
7.0.50.0200.08022.94
7.0.40.0030.03720.08
7.0.30.0100.03320.06
7.0.20.0070.04020.05
7.0.10.0100.03720.08
7.0.00.0030.08320.09
5.6.280.3902.11025.75
5.6.250.3832.11725.45
5.6.240.3872.11325.45
5.6.230.4402.01025.48
5.6.220.4432.03725.34
5.6.210.4272.05325.38
5.6.200.0132.46725.88
5.6.190.4102.01325.75
5.6.180.4902.01025.79
5.6.170.4872.01325.87
5.6.160.5071.99325.80
5.6.150.4302.07025.80
5.6.140.4132.08725.80
5.6.130.4702.03025.83
5.6.120.4732.02725.86
5.6.110.4272.07325.82
5.6.100.4632.03725.80
5.6.90.4732.02725.71
5.6.80.4672.03325.14
5.6.70.3972.10325.11
5.6.60.4302.07025.18
5.6.50.4502.04025.15
5.6.40.4202.08025.03
5.6.30.0032.49725.43
5.6.20.4902.01025.03
5.6.10.4102.09025.25
5.6.00.4231.93725.25
5.5.380.4132.07325.25
5.5.370.4332.04324.94
5.5.360.4332.01024.95
5.5.350.4672.00724.83
5.5.340.4631.99025.37
5.5.330.3572.09725.25
5.5.320.4731.99025.46
5.5.310.5401.92025.33
5.5.300.4901.97025.34
5.5.290.4971.97325.31
5.5.280.4632.02325.28
5.5.270.5101.96325.19
5.5.260.4402.01725.27
5.5.250.4901.96025.24
5.5.240.4771.97324.82
5.5.230.4432.01724.80
5.5.220.4771.98724.79
5.5.210.5201.89724.66
5.5.200.4871.94324.54
5.5.190.4901.98724.54
5.5.180.4271.97024.81
5.5.160.4731.95324.69
5.5.150.4431.93324.68
5.5.140.4731.96324.74
5.5.130.4432.01324.77
5.5.120.5371.87724.79
5.5.110.4531.86724.55
5.5.100.4232.00024.63
5.5.90.4031.95324.71
5.5.80.3972.01724.49
5.5.70.4731.95324.66
5.5.60.4901.96724.51
5.5.50.5101.93324.56
5.5.40.4531.97024.60
5.5.30.4531.97024.47
5.5.20.4701.97024.65
5.5.10.4531.98324.58
5.5.00.4671.97724.61
5.4.450.4572.02723.91
5.4.440.4132.03023.90
5.4.430.4832.00723.80
5.4.420.5401.93023.69
5.4.410.4132.02324.26
5.4.400.4571.97723.50
5.4.390.4202.00323.57
5.4.380.4372.00323.62
5.4.370.4771.96323.33
5.4.360.4601.97723.58
5.4.350.4731.94723.57
5.4.340.5001.93723.53
5.4.320.4971.94723.53
5.4.310.4132.02023.58
5.4.300.3702.09023.33
5.4.290.4302.02723.38
5.4.280.5131.91023.53
5.4.270.4631.96723.38
5.4.260.3901.67323.42
5.4.250.4472.02323.27
5.4.240.4332.02323.45
5.4.230.4871.90023.54
5.4.220.4931.95023.50
5.4.210.3602.08723.60
5.4.200.5171.94323.32
5.4.190.4871.97723.37
5.4.180.4332.02023.53
5.4.170.4831.93323.54
5.4.160.5301.92023.55
5.4.150.4272.03323.52
5.4.140.4701.98720.98
5.4.130.4901.94721.05
5.4.120.4371.99320.88
5.4.110.3831.62320.70
5.4.100.4171.62320.73
5.4.90.3671.89320.95
5.4.80.4272.04320.93
5.4.70.4731.96320.96
5.4.60.5071.96320.88
5.4.50.4171.98720.76
5.4.40.4202.00720.74
5.4.30.5001.94320.77
5.4.20.3672.10320.97
5.4.10.4671.98720.78
5.4.00.4701.73020.36
5.3.290.4671.98718.93
5.3.280.4571.98018.74
5.3.270.3771.99018.74
5.3.260.4102.04018.82
5.3.250.4472.01018.75
5.3.240.4631.97718.88
5.3.230.4771.97318.78
5.3.220.4431.96018.86
5.3.210.3431.83718.78
5.3.200.3801.52718.72
5.3.190.4871.96018.82
5.3.180.4602.00018.71
5.3.170.4102.03018.73
5.3.160.5301.86318.70
5.3.150.4332.01318.69
5.3.140.4471.95018.68
5.3.130.3972.07018.68
5.3.120.4172.01018.84
5.3.110.4431.98318.64
5.3.100.3201.67318.30
5.3.90.2571.80718.13
5.3.80.3431.57718.04
5.3.70.2771.33018.08
5.3.60.3231.59718.21
5.3.50.3771.66318.03
5.3.40.3101.48718.04
5.3.30.2501.61317.95
5.3.20.3201.63017.72
5.3.10.3631.68017.75
5.3.00.3431.92017.79
5.2.170.0000.03011.24
5.2.160.0100.05011.21
5.2.150.0070.07011.01
5.2.140.0070.05311.29
5.2.130.0070.05311.16
5.2.120.0100.05711.16
5.2.110.0070.04311.13
5.2.100.0070.06011.12
5.2.90.0000.05711.01
5.2.80.0030.05311.16
5.2.70.0030.02711.16
5.2.60.0030.03310.96
5.2.50.0030.04711.01
5.2.40.0030.06311.09
5.2.30.0000.04011.10
5.2.20.0000.05710.96
5.2.10.0000.02711.00
5.2.00.0070.05710.74
5.1.60.0000.05310.17
5.1.50.0000.02310.17
5.1.40.0030.05710.17
5.1.30.0030.02310.36
5.1.20.0070.05310.22
5.1.10.0070.04310.18
5.1.00.0100.02310.17
5.0.50.0000.0239.43
5.0.40.0100.0279.45
5.0.30.0030.0639.47
5.0.20.0030.0409.49
5.0.10.0030.0479.51
5.0.00.0030.0409.52
4.4.90.0000.03310.17
4.4.80.0000.03710.17
4.4.70.0030.02310.17
4.4.60.0000.02010.17
4.4.50.0030.03010.17
4.4.40.0030.02010.17
4.4.30.0000.04010.17
4.4.20.0070.03310.17
4.4.10.0000.0139.42
4.4.00.0000.0279.44
4.3.110.0030.0339.46
4.3.100.0000.0339.47
4.3.90.0070.0239.50
4.3.80.0000.0279.52
4.3.70.0030.0139.52
4.3.60.0030.0309.52
4.3.50.0000.0379.52
4.3.40.0000.0539.52
4.3.30.0000.0239.52
4.3.20.0030.0179.52
4.3.10.0070.0109.52
4.3.00.0000.0179.52

preferences:
37.8 ms | 400 KiB | 5 Q