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.0050.01416.36
7.4.00.0060.01315.90
7.3.130.0060.01215.80
7.3.120.0070.00716.02
7.3.110.0070.01015.93
7.3.100.0030.01215.97
7.3.90.0060.01216.07
7.3.80.0030.01015.84
7.3.70.0000.01416.09
7.3.60.0040.00716.22
7.3.50.0000.01716.01
7.3.40.0030.01016.16
7.3.30.0060.00816.18
7.3.20.0110.00618.41
7.3.10.0000.01218.23
7.3.00.0000.01518.60
7.2.260.0090.00916.13
7.2.250.0030.01416.41
7.2.240.0090.00916.05
7.2.230.0090.00916.25
7.2.220.0140.00716.39
7.2.210.0110.00716.14
7.2.200.0030.01016.12
7.2.190.0070.00716.33
7.2.180.0070.00716.23
7.2.170.0070.01116.09
7.2.160.0100.01016.42
7.2.150.0000.01418.55
7.2.140.0100.00618.94
7.2.130.0060.00918.94
7.2.120.0030.01318.91
7.2.110.0060.01018.92
7.2.100.0090.00918.94
7.2.90.0030.01018.62
7.2.80.0040.01218.92
7.2.70.0000.01918.95
7.2.60.0070.01118.64
7.2.50.0060.00918.96
7.2.40.0070.00718.99
7.2.30.0000.01718.89
7.2.20.0100.00719.03
7.2.10.0030.01218.89
7.2.00.0060.00920.06
7.1.330.0090.00617.54
7.1.320.0060.01317.89
7.1.310.0030.01417.80
7.1.300.0000.01217.89
7.1.290.0040.01117.75
7.1.280.0040.01117.93
7.1.270.0030.00917.91
7.1.260.0090.00617.74
7.1.250.0060.01117.80
7.1.240.0030.01317.46
7.1.230.0100.00617.91
7.1.220.0090.01217.86
7.1.210.0030.00917.82
7.1.200.0060.00917.91
7.1.190.0060.00917.59
7.1.180.0090.00617.73
7.1.170.0070.01117.80
7.1.160.0110.00717.77
7.1.150.0070.01017.92
7.1.140.0030.01117.89
7.1.130.0040.01117.58
7.1.120.0060.01217.50
7.1.110.0030.01417.80
7.1.100.0030.01317.78
7.1.90.0030.00917.95
7.1.80.0030.01417.57
7.1.70.0070.00718.53
7.1.60.0090.01418.87
7.1.50.0100.00918.29
7.1.40.0090.00917.79
7.1.30.0030.01017.65
7.1.20.0000.01617.72
7.1.10.0070.01017.53
7.1.00.0040.04421.04
7.0.330.0080.00417.57
7.0.320.0040.01117.48
7.0.310.0130.00317.48
7.0.300.0060.00917.46
7.0.290.0070.01017.43
7.0.280.0040.01417.51
7.0.270.0100.01017.59
7.0.260.0080.01117.31
7.0.250.0060.01117.35
7.0.240.0140.00317.68
7.0.230.0030.01017.37
7.0.220.0030.01217.49
7.0.210.0040.01217.44
7.0.200.0020.01318.04
7.0.190.0000.01617.65
7.0.180.0060.00917.27
7.0.170.0000.01417.67
7.0.160.0090.00917.57
7.0.150.0100.00617.43
7.0.140.0030.04420.88
7.0.130.0000.01317.51
7.0.120.0030.01017.46
7.0.110.0030.01217.53
7.0.100.0080.00517.45
7.0.90.0000.01617.56
7.0.80.0040.01817.23
7.0.70.0090.00617.28
7.0.60.0120.04519.28
7.0.50.0050.04818.31
7.0.40.0050.03516.91
7.0.30.0270.02716.77
7.0.20.0170.03316.84
7.0.10.0070.05216.88
7.0.00.0020.03316.75
5.6.400.0060.00916.74
5.6.390.0030.01616.91
5.6.380.0040.01816.46
5.6.370.0160.00716.76
5.6.360.0030.01716.57
5.6.350.0030.01716.24
5.6.340.0070.01416.88
5.6.330.0030.01716.82
5.6.320.0030.01716.66
5.6.310.0040.01816.39
5.6.300.0000.02016.53
5.6.290.0060.01616.77
5.6.280.0050.04719.69
5.6.270.0000.01716.29
5.6.260.0080.01116.45
5.6.250.0090.00916.50
5.6.240.0070.01616.49
5.6.230.0040.01816.32
5.6.220.0030.01416.47
5.6.210.0030.05519.31
5.6.200.0030.04218.23
5.6.190.0080.02719.17
5.6.180.2130.02619.42
5.6.170.0130.03719.35
5.6.160.0070.03019.25
5.6.150.0070.04918.19
5.6.140.0150.03518.24
5.6.130.0070.03318.20
5.6.120.0070.04419.66
5.6.110.0080.04319.53
5.6.100.0080.04519.68
5.6.90.0080.03419.75
5.6.80.0020.05019.28
5.6.70.2250.03219.38
5.6.60.0070.01516.52
5.6.50.0090.01216.60
5.6.40.0090.00916.36
5.6.30.0000.01916.65
5.6.20.0060.01916.65
5.6.10.0030.01316.48
5.6.00.0030.02116.37
5.5.380.0100.01416.40
5.5.370.0000.01716.67
5.5.360.0100.00916.38
5.5.350.0100.04719.43
5.5.340.0100.04718.15
5.5.330.0050.05619.37
5.5.320.0150.04819.32
5.5.310.0180.04819.25
5.5.300.0120.04518.22
5.5.290.0030.03918.04
5.5.280.0080.05219.64
5.5.270.0080.02819.52
5.5.260.0080.05319.65
5.5.250.0030.04319.45
5.5.240.1490.02919.17
5.5.230.0070.02716.51
5.5.220.0060.01516.26
5.5.210.0110.01116.52
5.5.200.0060.02216.18
5.5.190.0100.01716.56
5.5.180.0030.01616.53
5.5.170.0060.02216.46
5.5.160.0160.00716.39
5.5.150.0040.02216.58
5.5.140.0060.01916.05
5.5.130.0100.01016.10
5.5.120.0060.01316.21
5.5.110.0060.01916.23
5.5.100.0100.01316.51
5.5.90.0060.01216.49
5.5.80.0100.01716.29
5.5.70.0060.01916.72
5.5.60.0120.01916.00
5.5.50.0140.01116.48
5.5.40.0150.01216.32
5.5.30.0000.02416.21
5.5.20.0060.02216.14
5.5.10.0100.01616.66
5.5.00.0030.02016.50
5.4.450.0100.04617.27
5.4.440.0100.04017.13
5.4.430.0120.03217.25
5.4.420.0210.04217.36
5.4.410.0130.04317.01
5.4.400.0150.04717.06
5.4.390.0160.04416.96
5.4.380.0180.04417.04
5.4.370.0130.03716.88
5.4.360.0120.03916.88
5.4.350.0180.04317.05
5.4.340.0230.03016.96
5.4.330.0100.01013.31
5.4.320.0130.03716.98
5.4.310.0150.03416.86
5.4.300.0200.02717.17
5.4.290.0130.04917.08
5.4.280.0130.04616.95
5.4.270.0130.03617.06
5.4.260.0130.02317.17
5.4.250.0170.04417.08
5.4.240.0160.03116.79
5.4.230.0150.04817.00
5.4.220.0160.04317.00
5.4.210.0120.04916.86
5.4.200.0170.04017.00
5.4.190.0130.04716.79
5.4.180.0150.03417.04
5.4.170.0120.02816.91
5.4.160.0100.04216.94
5.4.150.0210.03617.03
5.4.140.0180.02915.65
5.4.130.0230.03715.79
5.4.120.0080.05415.55
5.4.110.0180.04215.67
5.4.100.0180.04215.60
5.4.90.0150.04215.73
5.4.80.0100.04915.67
5.4.70.0190.04115.68
5.4.60.0120.03815.77
5.4.50.0130.04215.54
5.4.40.0180.04115.61
5.4.30.0080.04915.80
5.4.20.0100.04815.68
5.4.10.0130.04215.68
5.4.00.0100.05015.26
5.3.290.0150.04514.34
5.3.280.0200.02914.24
5.3.270.0070.03614.38
5.3.260.0200.04014.34
5.3.250.0130.04714.25
5.3.240.0080.03614.61
5.3.230.0160.04614.38
5.3.220.0120.04514.38
5.3.210.0180.03014.35
5.3.200.0130.04614.28
5.3.190.0120.04814.25
5.3.180.0100.03914.41
5.3.170.0120.04214.53
5.3.160.0080.05414.30
5.3.150.0150.04614.43
5.3.140.0180.03014.33
5.3.130.0180.04414.33
5.3.120.0130.03114.35
5.3.110.0100.04714.32
5.3.100.0150.04514.19
5.3.90.0150.04013.99
5.3.80.0100.04813.96
5.3.70.0170.04214.19
5.3.60.0180.04113.93
5.3.50.0120.04514.04
5.3.40.0120.04513.96
5.3.30.0120.04114.29
5.3.20.0150.04113.75
5.3.10.0120.04213.59
5.3.00.0130.02513.91
5.2.170.0170.05012.20
5.2.160.0130.06312.20
5.2.150.0200.05312.20
5.2.140.0230.05312.20
5.2.130.0100.05312.20
5.2.120.0170.05312.20
5.2.110.0130.02712.20
5.2.100.0200.04312.20
5.2.90.0130.04312.20
5.2.80.0200.05312.20
5.2.70.0100.04012.20
5.2.60.0170.03712.20
5.2.50.0200.05712.20
5.2.40.0130.06012.20
5.2.30.0170.03012.20
5.2.20.0200.03012.20
5.2.10.0170.03712.20
5.2.00.0130.03312.20
5.1.60.0130.05312.20
5.1.50.0300.02712.20
5.1.40.0070.03312.20
5.1.30.0100.02712.20
5.1.20.0130.05312.20
5.1.10.0170.03712.20
5.1.00.0070.03312.20
5.0.50.0100.04012.20
5.0.40.0070.04312.20
5.0.30.0100.05312.20
5.0.20.0030.04712.20
5.0.10.0100.04012.20
5.0.00.0130.05712.20
4.4.90.0000.02312.20
4.4.80.0100.01312.20
4.4.70.0030.03312.20
4.4.60.0030.03312.20
4.4.50.0100.03012.20
4.4.40.0030.05712.20
4.4.30.0100.01312.20
4.4.20.0000.02712.20
4.4.10.0030.01712.20
4.4.00.0030.05312.20
4.3.110.0070.03712.20
4.3.100.0030.03012.20
4.3.90.0130.02012.20
4.3.80.0070.04312.20
4.3.70.0000.03712.20
4.3.60.0130.02312.20
4.3.50.0030.03712.20
4.3.40.0000.04712.20
4.3.30.0000.04012.20
4.3.20.0030.03312.20
4.3.10.0070.03012.20
4.3.00.0070.03312.20

preferences:
42.48 ms | 401 KiB | 5 Q