3v4l.org

run code in 300+ PHP versions simultaneously
<?php $classmap1 = array(); for ($i=1; $i<=100; $i++) { $classmap1['a'.$i] = $i+1; } $classmap2 = array(); for ($i=1; $i<=100; $i++) { $classmap2['b'.$i] = $i+1; } $startTimeMerge = microtime(true); $map = array_merge($classmap1, $classmap2); $endTimeMerge = microtime(true); $startTimeForeach = microtime(true); foreach ($classmap2 as $k => $v) { $classmap1[$k] = $v; } $endTimeForeach = microtime(true); abstract class merging { public static function amerge(array $a, array &$b) { $acopy = $a; foreach ($b as $key => $value) { $acopy[$key] = $value; } return $acopy; } } $startTimeFunc = microtime(true); merging::amerge($classmap1, $classmap2); $endTimeFunc = microtime(true); echo "Merging took " . (($endTimeMerge - $startTimeMerge)*1000) ." microseconds<br />\n"; //var_dump($map); echo "Foreach took " . (($endTimeForeach - $startTimeForeach)*1000) ." microseconds<br />\n"; //var_dump($classmap1); 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.10.0060.01315.13
7.4.00.0130.00614.98
7.3.130.0140.00315.01
7.3.120.0040.01214.71
7.3.110.0080.00814.70
7.3.100.0140.00014.91
7.3.90.0030.00914.91
7.3.80.0060.00914.87
7.3.70.0090.00914.96
7.3.60.0060.00915.01
7.3.50.0120.00314.90
7.3.40.0060.00914.97
7.3.30.0090.00615.00
7.3.20.0040.01116.82
7.3.10.0040.01216.55
7.3.00.0030.01016.71
7.2.260.0100.01015.41
7.2.250.0110.00715.07
7.2.240.0070.01015.02
7.2.230.0040.01115.33
7.2.220.0070.00715.05
7.2.210.0000.01715.08
7.2.200.0080.00415.22
7.2.190.0100.00315.25
7.2.180.0100.00614.99
7.2.170.0030.01015.30
7.2.160.0040.01115.02
7.2.150.0070.01116.93
7.2.140.0060.00916.98
7.2.130.0030.01317.14
7.2.120.0030.01016.98
7.2.110.0070.00717.01
7.2.100.0140.00017.03
7.2.90.0060.00616.82
7.2.80.0130.00317.10
7.2.70.0030.01416.98
7.2.60.0040.01116.98
7.2.50.0090.00916.90
7.2.40.0000.01317.02
7.2.30.0060.01316.98
7.2.20.0060.01217.05
7.2.10.0040.00816.70
7.2.00.0040.01018.15
7.1.330.0030.01015.84
7.1.320.0050.00815.87
7.1.310.0100.00615.93
7.1.300.0000.01315.75
7.1.290.0090.00615.66
7.1.280.0000.01015.77
7.1.270.0070.00315.88
7.1.260.0060.01015.90
7.1.250.0080.00315.54
7.1.240.0070.00715.79
7.1.230.0070.00415.97
7.1.220.0080.00615.89
7.1.210.0040.01215.79
7.1.200.0040.01115.86
7.1.190.0060.00915.88
7.1.180.0000.01415.98
7.1.170.0070.00715.83
7.1.160.0070.00715.99
7.1.150.0030.01015.88
7.1.140.0050.00315.95
7.1.130.0060.00915.68
7.1.120.0060.00915.81
7.1.110.0120.00315.62
7.1.100.0080.00015.79
7.1.90.0060.00915.68
7.1.80.0030.01015.96
7.1.70.0040.00716.57
7.1.60.0080.01017.63
7.1.50.0070.00916.31
7.1.40.0120.00315.71
7.1.30.0030.01015.92
7.1.20.0070.00715.98
7.1.10.0070.00715.76
7.1.00.0030.02019.00
7.0.330.0070.00715.46
7.0.320.0060.00615.44
7.0.310.0040.00815.21
7.0.300.0000.01215.43
7.0.290.0120.00315.24
7.0.280.0100.00015.11
7.0.270.0060.00915.35
7.0.260.0030.00915.35
7.0.250.0110.00715.54
7.0.240.0110.00415.32
7.0.230.0090.00615.60
7.0.220.0070.01015.66
7.0.210.0000.01315.43
7.0.200.0020.01015.97
7.0.190.0000.01415.36
7.0.180.0000.01315.51
7.0.170.0030.00715.56
7.0.160.0030.01015.54
7.0.150.0070.00715.31
7.0.140.0020.04418.72
7.0.130.0070.00715.16
7.0.120.0040.00415.20
7.0.110.0040.01115.24
7.0.100.0030.03217.65
7.0.90.0080.02517.79
7.0.80.0040.02617.58
7.0.70.0100.04217.82
7.0.60.0100.01917.73
7.0.50.0100.04217.83
7.0.40.0080.04216.78
7.0.30.0050.04416.77
7.0.20.0050.03716.79
7.0.10.0070.04716.83
7.0.00.0100.04316.81
5.6.400.0000.01114.47
5.6.390.0110.00414.51
5.6.380.0120.00314.56
5.6.370.0040.00814.81
5.6.360.0140.00014.54
5.6.350.0030.01314.69
5.6.340.0150.00614.57
5.6.330.0070.01414.73
5.6.320.0000.01114.30
5.6.310.0070.00714.54
5.6.300.0040.01114.19
5.6.290.0040.01114.48
5.6.280.0070.04217.94
5.6.270.0030.01414.38
5.6.260.0070.01014.82
5.6.250.0080.02717.46
5.6.240.0030.02817.64
5.6.230.0030.02517.43
5.6.220.0030.02717.48
5.6.210.0050.04517.50
5.6.200.0080.03817.97
5.6.190.0080.03017.74
5.6.180.0100.03517.98
5.6.170.0050.03917.76
5.6.160.0120.03317.92
5.6.150.0030.05017.91
5.6.140.0070.04618.00
5.6.130.0080.04217.79
5.6.120.0050.04817.82
5.6.110.0030.03317.74
5.6.100.0100.04317.85
5.6.90.0150.03317.78
5.6.80.0030.02917.41
5.6.70.0080.02717.35
5.6.60.0070.04317.57
5.6.50.0050.04317.48
5.6.40.0080.04317.49
5.6.30.0100.03517.46
5.6.20.0020.04617.51
5.6.10.0080.04417.50
5.6.00.0120.03417.51
5.5.380.0070.02217.64
5.5.370.0090.02117.54
5.5.360.0020.02817.36
5.5.350.0020.04317.43
5.5.340.0030.04517.67
5.5.330.0110.03817.67
5.5.320.0120.04317.83
5.5.310.0030.04917.57
5.5.300.0070.04417.76
5.5.290.0030.04817.72
5.5.280.0100.04517.59
5.5.270.0080.03517.73
5.5.260.0070.04717.54
5.5.250.0120.02317.37
5.5.240.0080.04117.43
5.5.230.0030.04317.14
5.5.220.0080.03017.33
5.5.210.0060.04117.21
5.5.200.0090.03617.43
5.5.190.0060.04517.32
5.5.180.0080.04017.27
5.5.170.0030.01214.26
5.5.160.0080.04317.35
5.5.150.0050.04317.28
5.5.140.0060.04317.20
5.5.130.0060.04117.23
5.5.120.0080.04317.18
5.5.110.0140.03717.32
5.5.100.0110.03717.24
5.5.90.0050.04217.10
5.5.80.0070.04717.21
5.5.70.0030.03017.21
5.5.60.0000.04617.01
5.5.50.0050.03717.19
5.5.40.0130.03517.12
5.5.30.0080.03517.39
5.5.20.0050.03017.19
5.5.10.0070.04417.31
5.5.00.0110.03617.13
5.4.450.0030.04516.51
5.4.440.0070.04216.50
5.4.430.0130.03516.47
5.4.420.0030.03916.48
5.4.410.0060.04416.42
5.4.400.0010.03916.32
5.4.390.0070.03716.14
5.4.380.0000.04616.20
5.4.370.0060.03816.32
5.4.360.0040.04616.34
5.4.350.0070.04416.24
5.4.340.0060.04316.24
5.4.330.0090.00613.46
5.4.320.0030.04216.30
5.4.310.0140.03516.32
5.4.300.0070.04216.33
5.4.290.0070.04016.30
5.4.280.0020.03116.18
5.4.270.0030.04616.32
5.4.260.0060.04116.18
5.4.250.0070.03716.29
5.4.240.0050.03816.24
5.4.230.0090.04216.25
5.4.220.0090.03916.24
5.4.210.0030.04616.34
5.4.200.0050.04216.32
5.4.190.0080.03716.31
5.4.180.0110.03816.29
5.4.170.0100.03816.24
5.4.160.0130.03016.28
5.4.150.0050.03816.32
5.4.140.0050.02314.96
5.4.130.0080.03614.95
5.4.120.0080.03814.96
5.4.110.0070.04214.97
5.4.100.0030.04314.99
5.4.90.0100.03614.93
5.4.80.0050.04514.94
5.4.70.0000.03414.96
5.4.60.0030.04114.94
5.4.50.0100.04014.98
5.4.40.0030.03314.96
5.4.30.0020.03014.99
5.4.20.0050.03714.95
5.4.10.0070.02314.90
5.4.00.0020.02314.68
5.3.290.0080.04214.17
5.3.280.0060.04114.11
5.3.270.0050.04114.13
5.3.260.0070.04614.10
5.3.250.0040.03214.03
5.3.240.0070.03714.05
5.3.230.0050.03614.05
5.3.220.0040.04114.04
5.3.210.0080.04014.04
5.3.200.0100.03314.11
5.3.190.0020.04214.06
5.3.180.0070.03914.03
5.3.170.0050.04114.03
5.3.160.0050.04014.11
5.3.150.0040.03914.01
5.3.140.0020.03214.02
5.3.130.0070.03314.04
5.3.120.0070.02214.04
5.3.110.0060.04314.03
5.3.100.0050.03813.78
5.3.90.0030.04513.72
5.3.80.0020.04113.72
5.3.70.0050.04113.77
5.3.60.0030.03513.84
5.3.50.0130.03213.79
5.3.40.0050.04013.75
5.3.30.0070.04213.74
5.3.20.0040.03913.63
5.3.10.0050.04113.63
5.3.00.0070.02313.53
5.2.170.0100.05011.31
5.2.160.0000.04711.21
5.2.150.0070.06311.29
5.2.140.0100.05011.23
5.2.130.0030.05311.24
5.2.120.0000.07011.25
5.2.110.0030.06011.27
5.2.100.0130.05011.25
5.2.90.0130.02711.11
5.2.80.0000.05711.24
5.2.70.0000.06011.09
5.2.60.0030.06311.01
5.2.50.0000.04711.15
5.2.40.0070.05711.13
5.2.30.0030.04711.16
5.2.20.0070.05311.03
5.2.10.0070.04710.93
5.2.00.0070.06010.75
5.1.60.0030.0539.92
5.1.50.0170.04310.07
5.1.40.0000.05310.12
5.1.30.0030.05710.43
5.1.20.0070.06010.56
5.1.10.0030.05710.00
5.1.00.0030.05010.10
5.0.50.0000.0479.13
5.0.40.0030.0439.13
5.0.30.0000.0679.13
5.0.20.0000.0439.13
5.0.10.0000.0479.13
5.0.00.0070.0539.13
4.4.90.0000.0379.13
4.4.80.0000.0339.13
4.4.70.0030.0339.13
4.4.60.0030.0339.13
4.4.50.0030.0339.13
4.4.40.0000.0579.13
4.4.30.0070.0339.13
4.4.20.0030.0309.13
4.4.10.0000.0379.13
4.4.00.0000.0539.13
4.3.110.0070.0309.13
4.3.100.0130.0139.13
4.3.90.0030.0309.13
4.3.80.0070.0479.13
4.3.70.0070.0309.13
4.3.60.0000.0339.13
4.3.50.0000.0339.13
4.3.40.0000.0339.13
4.3.30.0000.0379.13
4.3.20.0000.0409.13
4.3.10.0030.0339.13
4.3.00.0000.0379.13

preferences:
40.12 ms | 401 KiB | 5 Q