3v4l.org

run code in 300+ PHP versions simultaneously
<?php $classmap1 = array(); for ($i=1; $i<=5000; $i++) { $classmap1['a'.$i] = $i+1; } $classmap2 = array(); for ($i=1; $i<=5000; $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.4.10.0160.00716.25
7.4.00.0110.01016.40
7.3.130.0070.01416.16
7.3.120.0080.01316.42
7.3.110.0090.01316.37
7.3.100.0050.01316.48
7.3.90.0070.00916.12
7.3.80.0060.00916.19
7.3.70.0090.00916.22
7.3.60.0060.01316.32
7.3.50.0090.00616.08
7.3.40.0090.00916.31
7.3.30.0030.01416.19
7.3.20.0030.01418.64
7.3.10.0040.01318.63
7.3.00.0070.01218.45
7.2.260.0140.00716.56
7.2.250.0100.01316.47
7.2.240.0050.01416.57
7.2.230.0080.01116.30
7.2.220.0030.01516.54
7.2.210.0060.00916.39
7.2.200.0090.00816.48
7.2.190.0050.01416.44
7.2.180.0110.00516.44
7.2.170.0080.01016.34
7.2.160.0080.00416.46
7.2.150.0100.00718.90
7.2.140.0100.01018.95
7.2.130.0100.00318.94
7.2.120.0000.01418.96
7.2.110.0030.01618.71
7.2.100.0070.01118.58
7.2.90.0090.00618.77
7.2.80.0110.00419.07
7.2.70.0100.00618.83
7.2.60.0070.00719.07
7.2.50.0030.01719.06
7.2.40.0090.00318.88
7.2.30.0070.01018.80
7.2.20.0090.00918.90
7.2.10.0040.01218.94
7.2.00.0060.00920.19
7.1.330.0100.00817.85
7.1.320.0100.00817.68
7.1.310.0030.01118.00
7.1.300.0060.01217.75
7.1.290.0060.01017.89
7.1.280.0030.01317.72
7.1.270.0050.01017.82
7.1.260.0100.00717.79
7.1.250.0030.01117.76
7.1.240.0070.00417.96
7.1.230.0080.00817.60
7.1.220.0030.01317.96
7.1.210.0170.00317.91
7.1.200.0000.01717.82
7.1.190.0030.01317.92
7.1.180.0030.01417.51
7.1.170.0040.01417.73
7.1.160.0000.01117.84
7.1.150.0070.01017.88
7.1.140.0000.01117.78
7.1.130.0030.01017.80
7.1.120.0100.00717.83
7.1.110.0000.01117.72
7.1.100.0090.00618.01
7.1.90.0040.01217.69
7.1.80.0080.01117.85
7.1.70.0050.00818.57
7.1.60.0070.01318.80
7.1.50.0050.01218.24
7.1.40.0060.01117.96
7.1.30.0030.01017.57
7.1.20.0070.01017.91
7.1.10.0130.00317.73
7.1.00.0070.04821.07
7.0.330.0040.00817.52
7.0.320.0070.01017.20
7.0.310.0000.01017.24
7.0.300.0000.01217.13
7.0.290.0030.00717.27
7.0.280.0030.00817.57
7.0.270.0040.01117.51
7.0.260.0030.01417.58
7.0.250.0000.01417.30
7.0.240.0080.00817.62
7.0.230.0060.01017.66
7.0.220.0000.01817.64
7.0.210.0030.01017.32
7.0.200.0020.01318.22
7.0.190.0100.00717.32
7.0.180.0060.01317.50
7.0.170.0070.01017.50
7.0.160.0030.00817.38
7.0.150.0090.00917.20
7.0.140.0030.04120.79
7.0.130.0060.00617.60
7.0.120.0000.01717.61
7.0.110.0000.01117.53
7.0.100.0040.01217.29
7.0.90.0060.01017.28
7.0.80.0060.01017.39
7.0.70.0050.02620.45
7.0.60.0050.04120.70
7.0.50.0050.03520.70
7.0.40.0050.04016.97
7.0.30.0050.04117.04
7.0.20.0050.03817.00
7.0.10.0050.04916.91
7.0.00.0060.04816.98
5.6.400.0060.01617.30
5.6.390.0070.01417.05
5.6.380.0040.01817.09
5.6.370.0030.01717.20
5.6.360.0070.01716.98
5.6.350.0130.01017.21
5.6.340.0100.01016.86
5.6.330.0000.02217.05
5.6.320.0000.01917.26
5.6.310.0040.01517.04
5.6.300.0060.01217.05
5.6.290.0100.01317.14
5.6.280.0050.04820.25
5.6.270.0070.01717.09
5.6.260.0070.01617.14
5.6.250.0030.01717.21
5.6.240.0130.01016.95
5.6.230.0000.02317.08
5.6.220.0090.03120.13
5.6.210.0070.03820.08
5.6.200.0020.05320.29
5.6.190.0100.04720.29
5.6.180.0070.05020.27
5.6.170.0060.04820.37
5.6.160.0080.04120.24
5.6.150.0110.04420.38
5.6.140.0060.04520.43
5.6.130.0080.04820.23
5.6.120.0080.04820.36
5.6.110.0080.04920.16
5.6.100.0050.05220.39
5.6.90.0000.04920.32
5.6.80.0130.04220.01
5.6.70.0050.05119.98
5.6.60.0040.04719.92
5.6.50.0050.04720.08
5.6.40.0030.05020.10
5.6.30.0090.04519.95
5.6.20.0180.04320.12
5.6.10.0100.04620.02
5.6.00.0050.05019.92
5.5.380.0130.01016.62
5.5.370.0030.02016.94
5.5.360.0070.04520.14
5.5.350.0020.05620.08
5.5.340.0100.04620.15
5.5.330.0080.05120.06
5.5.320.0100.04220.21
5.5.310.0100.04720.30
5.5.300.0070.04820.01
5.5.290.0100.04920.02
5.5.280.0090.04820.12
5.5.270.0050.04820.12
5.5.260.0050.04520.07
5.5.250.0070.05019.91
5.5.240.0080.05019.75
5.5.230.0070.04419.84
5.5.220.0080.05119.78
5.5.210.0080.04619.71
5.5.200.0030.05319.78
5.5.190.0100.03919.89
5.5.180.0110.04719.80
5.5.170.0080.01517.12
5.5.160.0080.04619.98
5.5.150.0100.04719.90
5.5.140.0100.04519.97
5.5.130.0070.03519.79
5.5.120.0030.05019.92
5.5.110.0080.04819.85
5.5.100.0050.04719.74
5.5.90.0070.04219.77
5.5.80.0050.04819.93
5.5.70.0020.05319.71
5.5.60.0030.05219.65
5.5.50.0070.04719.70
5.5.40.0070.04719.65
5.5.30.0030.04919.87
5.5.20.0080.04319.84
5.5.10.0080.04819.73
5.5.00.0050.04619.64
5.4.450.0070.04217.88
5.4.440.0030.05417.82
5.4.430.0000.05317.89
5.4.420.0060.04317.88
5.4.410.0090.04017.74
5.4.400.0080.04117.78
5.4.390.0050.04117.79
5.4.380.0070.03217.71
5.4.370.0050.04317.74
5.4.360.0030.04417.70
5.4.350.0030.04717.65
5.4.340.0030.04817.65
5.4.330.0110.01213.89
5.4.320.0020.05017.72
5.4.310.0050.04517.76
5.4.300.0050.04117.72
5.4.290.0030.05017.76
5.4.280.0050.04717.71
5.4.270.0070.03517.69
5.4.260.0060.04317.72
5.4.250.0060.04617.71
5.4.240.0050.04317.74
5.4.230.0080.04517.64
5.4.220.0020.05217.72
5.4.210.0120.04017.68
5.4.200.0030.05017.74
5.4.190.0030.03717.75
5.4.180.0050.04517.72
5.4.170.0070.04517.69
5.4.160.0080.04517.70
5.4.150.0020.05217.74
5.4.140.0020.05016.37
5.4.130.0030.04816.35
5.4.120.0070.03916.37
5.4.110.0110.04616.39
5.4.100.0070.04516.44
5.4.90.0050.04016.44
5.4.80.0070.04316.38
5.4.70.0030.05016.44
5.4.60.0060.04316.46
5.4.50.0070.04516.38
5.4.40.0000.04716.40
5.4.30.0080.03716.37
5.4.20.0030.04516.37
5.4.10.0050.04316.43
5.4.00.0090.04216.15
5.3.290.0050.05015.32
5.3.280.0080.03815.33
5.3.270.0080.04515.29
5.3.260.0020.04915.31
5.3.250.0100.04315.32
5.3.240.0000.04915.31
5.3.230.0030.04115.38
5.3.220.0020.04715.27
5.3.210.0030.05115.35
5.3.200.0030.03915.36
5.3.190.0000.04515.27
5.3.180.0030.04515.29
5.3.170.0050.04615.34
5.3.160.0020.05115.27
5.3.150.0030.03315.32
5.3.140.0100.04515.28
5.3.130.0020.05315.24
5.3.120.0070.04715.28
5.3.110.0020.04915.33
5.3.100.0030.04715.05
5.3.90.0050.04315.09
5.3.80.0020.04915.04
5.3.70.0020.03915.05
5.3.60.0020.03614.99
5.3.50.0020.05014.93
5.3.40.0020.03814.96
5.3.30.0050.03814.96
5.3.20.0000.03314.85
5.3.10.0070.04414.80
5.3.00.0030.05214.79
5.2.170.0000.05314.77
5.2.160.0000.05714.77
5.2.150.0030.06014.77
5.2.140.0000.04714.77
5.2.130.0000.06314.77
5.2.120.0000.05014.77
5.2.110.0000.05714.77
5.2.100.0070.05714.77
5.2.90.0030.05314.77
5.2.80.0030.05714.77
5.2.70.0000.05014.77
5.2.60.0000.04314.77
5.2.50.0000.06714.77
5.2.40.0070.05014.77
5.2.30.0070.04014.77
5.2.20.0000.04014.77
5.2.10.0100.05314.77
5.2.00.0030.05714.77
5.1.60.0070.04714.77
5.1.50.0030.05014.77
5.1.40.0030.04014.77
5.1.30.0070.05014.77
5.1.20.0000.05014.77
5.1.10.0000.05714.77
5.1.00.0030.05314.77
5.0.50.0030.04714.77
5.0.40.0000.04014.77
5.0.30.0030.05714.77
5.0.20.0070.03714.77
5.0.10.0000.02714.77
5.0.00.0000.05714.77
4.4.90.0000.03014.77
4.4.80.0000.03014.77
4.4.70.0030.02714.77
4.4.60.0000.03714.77
4.4.50.0000.03714.77
4.4.40.0000.04314.77
4.4.30.0000.03014.77
4.4.20.0030.03314.77
4.4.10.0070.03014.77
4.4.00.0000.04314.77
4.3.110.0070.03014.77
4.3.100.0000.03014.77
4.3.90.0030.03014.77
4.3.80.0000.02714.77
4.3.70.0070.03014.77
4.3.60.0030.01714.77
4.3.50.0000.01714.77
4.3.40.0000.03014.77
4.3.30.0000.01714.77
4.3.20.0000.03014.77
4.3.10.0000.01714.77
4.3.00.0000.03714.77

preferences:
42.8 ms | 401 KiB | 5 Q