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.0130.00616.47
7.4.00.0100.01316.40
7.3.130.0030.02016.09
7.3.120.0110.01116.59
7.3.110.0060.01216.55
7.3.100.0120.00316.29
7.3.90.0030.01216.09
7.3.80.0060.00616.45
7.3.70.0070.01016.17
7.3.60.0080.00816.21
7.3.50.0030.01016.14
7.3.40.0120.00915.92
7.3.30.0090.00916.30
7.3.20.0100.00618.58
7.3.10.0160.00818.42
7.3.00.0140.01118.56
7.2.260.0130.01016.62
7.2.250.0070.01416.35
7.2.240.0060.01316.38
7.2.230.0030.01316.47
7.2.220.0090.00916.54
7.2.210.0090.00916.60
7.2.200.0070.00716.61
7.2.190.0070.01116.53
7.2.180.0090.00916.20
7.2.170.0040.01416.33
7.2.160.0040.00716.36
7.2.150.0130.00318.52
7.2.140.0100.00718.95
7.2.130.0140.01218.72
7.2.120.0160.00718.55
7.2.110.0160.01118.89
7.2.100.0170.01218.54
7.2.90.0110.01418.64
7.2.80.0180.00718.70
7.2.70.0140.01318.78
7.2.60.0170.01418.93
7.2.50.0190.00618.36
7.2.40.0170.00718.68
7.2.30.0180.00618.70
7.2.20.0110.01318.60
7.2.10.0170.00918.93
7.2.00.0140.01318.82
7.1.330.0060.01217.92
7.1.320.0040.01417.78
7.1.310.0050.00817.94
7.1.300.0030.01317.68
7.1.290.0030.01317.79
7.1.280.0030.01017.71
7.1.270.0030.01017.89
7.1.260.0030.01717.99
7.1.250.0100.02117.45
7.1.240.0080.00817.80
7.1.230.0030.01617.87
7.1.220.0070.01017.89
7.1.210.0110.00717.52
7.1.200.0120.00917.84
7.1.190.0030.01317.97
7.1.180.0040.01217.61
7.1.170.0030.01217.84
7.1.160.0110.00717.93
7.1.150.0030.00717.91
7.1.140.0100.00617.90
7.1.130.0070.01017.77
7.1.120.0030.01017.86
7.1.110.0030.01318.03
7.1.100.0040.00817.61
7.1.90.0100.00617.63
7.1.80.0070.01017.54
7.1.70.0030.01218.46
7.1.60.0070.01618.79
7.1.50.0130.01527.45
7.1.40.0000.01817.62
7.1.30.0070.01117.58
7.1.20.0040.01517.76
7.1.10.0060.01217.71
7.1.00.0050.04720.94
7.0.330.0000.01617.34
7.0.320.0030.00917.30
7.0.310.0000.01317.38
7.0.300.0000.01717.58
7.0.290.0030.00917.38
7.0.280.0040.00717.50
7.0.270.0030.01317.49
7.0.260.0000.01517.60
7.0.250.0100.00617.58
7.0.240.0070.01017.26
7.0.230.0070.01117.53
7.0.220.0070.00717.59
7.0.210.0030.01217.50
7.0.200.0050.00818.17
7.0.190.0040.01217.23
7.0.180.0040.00717.49
7.0.170.0040.00717.68
7.0.160.0030.01317.58
7.0.150.0100.00717.17
7.0.140.0070.04320.67
7.0.130.0060.00917.66
7.0.120.0110.00717.51
7.0.110.0030.01517.54
7.0.100.0060.00617.25
7.0.90.0000.01817.70
7.0.80.0090.00917.54
7.0.70.0060.00917.69
7.0.60.0110.04319.67
7.0.50.0020.03418.37
7.0.40.0070.04916.95
7.0.30.0180.04316.96
7.0.20.0220.04116.77
7.0.10.0070.03716.77
7.0.00.0070.04716.87
5.6.400.0040.01517.49
5.6.390.0030.01617.09
5.6.380.0060.01617.74
5.6.370.0070.01417.38
5.6.360.0110.01417.89
5.6.350.0060.01017.40
5.6.340.0100.01017.77
5.6.330.0040.01417.77
5.6.320.0000.01617.80
5.6.310.0130.00917.46
5.6.300.0070.01717.22
5.6.290.0070.01417.27
5.6.280.0050.05220.93
5.6.270.0070.01717.41
5.6.260.0000.02117.45
5.6.250.0040.01617.64
5.6.240.0070.01017.67
5.6.230.0180.00617.34
5.6.220.0000.02217.43
5.6.210.0050.05420.75
5.6.200.0080.03519.38
5.6.190.0100.04220.51
5.6.180.0100.03020.50
5.6.170.0170.04320.56
5.6.160.0070.03220.39
5.6.150.0100.05019.35
5.6.140.0120.04019.32
5.6.130.0080.02919.30
5.6.120.0060.05720.77
5.6.110.0100.05320.82
5.6.100.0070.05020.76
5.6.90.0070.05520.78
5.6.80.0100.05020.57
5.6.70.0060.01317.45
5.6.60.0070.01417.61
5.6.50.0030.02017.21
5.6.40.0060.01317.43
5.6.30.0060.01617.39
5.6.20.0000.02417.28
5.6.10.0160.00617.16
5.6.00.0030.02017.53
5.5.380.0030.02217.70
5.5.370.0090.01217.53
5.5.360.0060.01617.57
5.5.350.0020.03420.45
5.5.340.0070.03519.05
5.5.330.0090.03420.53
5.5.320.0200.02920.36
5.5.310.0100.03220.37
5.5.300.0120.04719.35
5.5.290.0070.05219.43
5.5.280.0030.03320.77
5.5.270.0100.02320.79
5.5.260.0030.03520.80
5.5.250.0080.04920.49
5.5.240.0150.04720.41
5.5.230.0160.00617.15
5.5.220.0040.01417.65
5.5.210.0090.01817.57
5.5.200.0060.01017.62
5.5.190.0060.01617.28
5.5.180.0090.01217.58
5.5.170.0030.01717.66
5.5.160.0090.01217.05
5.5.150.0070.01617.59
5.5.140.0040.01517.44
5.5.130.0070.01717.32
5.5.120.0030.02017.45
5.5.110.0030.02217.19
5.5.100.0130.01017.52
5.5.90.0030.01717.39
5.5.80.0060.01517.35
5.5.70.0100.00717.52
5.5.60.0060.01917.53
5.5.50.0070.02317.34
5.5.40.0060.02217.52
5.5.30.0110.01517.53
5.5.20.0130.01317.34
5.5.10.0100.01316.98
5.5.00.0040.02117.40
5.4.450.0130.04618.18
5.4.440.0120.04518.52
5.4.430.0050.03018.46
5.4.420.0070.03618.43
5.4.410.0100.03318.30
5.4.400.0050.04617.98
5.4.390.0050.04718.26
5.4.380.0080.03118.18
5.4.370.0080.04618.22
5.4.360.0100.03118.23
5.4.350.0110.02918.15
5.4.340.0150.04318.20
5.4.330.0000.02214.43
5.4.320.0070.04518.04
5.4.310.0070.03318.10
5.4.300.0100.04217.99
5.4.290.0030.03318.12
5.4.280.0150.04017.99
5.4.270.0100.04518.10
5.4.260.0100.05018.21
5.4.250.0050.03917.98
5.4.240.0120.02218.26
5.4.230.0080.04318.13
5.4.220.0100.04518.12
5.4.210.0140.03918.17
5.4.200.0050.03318.07
5.4.190.0070.03018.15
5.4.180.0070.04117.93
5.4.170.0050.04518.07
5.4.160.0080.04318.15
5.4.150.0110.03717.95
5.4.140.0000.03816.71
5.4.130.0100.04216.79
5.4.120.0050.05016.83
5.4.110.0080.04316.95
5.4.100.0030.03716.87
5.4.90.0080.02516.85
5.4.80.0050.03016.85
5.4.70.0120.04516.92
5.4.60.0130.04016.80
5.4.50.0070.03616.84
5.4.40.0070.04316.88
5.4.30.0070.04516.85
5.4.20.0050.03416.77
5.4.10.0050.03316.80
5.4.00.0070.03016.51
5.3.290.0050.05215.42
5.3.280.0020.04215.07
5.3.270.0020.03515.29
5.3.260.0080.02715.36
5.3.250.0020.03215.27
5.3.240.0080.02615.22
5.3.230.0090.03615.21
5.3.220.0100.03015.23
5.3.210.0100.04815.24
5.3.200.0050.04215.10
5.3.190.0050.02915.28
5.3.180.0030.03115.35
5.3.170.0110.03215.32
5.3.160.0080.03515.35
5.3.150.0050.02815.21
5.3.140.0080.02615.33
5.3.130.0020.04115.24
5.3.120.0030.03015.23
5.3.110.0070.04915.21
5.3.100.0030.03014.89
5.3.90.0050.02715.01
5.3.80.0050.03014.82
5.3.70.0040.03314.88
5.3.60.0070.03014.82
5.3.50.0020.05214.88
5.3.40.0050.02814.83
5.3.30.0030.03014.91
5.3.20.0050.03214.71
5.3.10.0070.03814.61
5.3.00.0050.02814.62
5.2.170.0170.05311.20
5.2.160.0070.06311.11
5.2.150.0030.03311.21
5.2.140.0070.02711.20
5.2.130.0000.04311.07
5.2.120.0000.04711.13
5.2.110.0000.07011.18
5.2.100.0100.02011.12
5.2.90.0030.02711.11
5.2.80.0030.03311.15
5.2.70.0030.03011.05
5.2.60.0000.06011.13
5.2.50.0100.04011.18
5.2.40.0000.04011.14
5.2.30.0030.05011.00
5.2.20.0030.05011.01
5.2.10.0000.03010.89
5.2.00.0030.02710.89
5.1.60.0000.02710.16
5.1.50.0000.0309.95
5.1.40.0030.0409.99
5.1.30.0030.03010.26
5.1.20.0070.03010.37
5.1.10.0070.05710.14
5.1.00.0000.04310.21
5.0.50.0100.0239.54
5.0.40.0070.0439.54
5.0.30.0070.0409.54
5.0.20.0000.0279.54
5.0.10.0000.0279.54
5.0.00.0000.0409.54
4.4.90.0000.0279.54
4.4.80.0100.0239.54
4.4.70.0000.0379.54
4.4.60.0000.0279.54
4.4.50.0030.0139.54
4.4.40.0030.0279.54
4.4.30.0000.0179.54
4.4.20.0070.0139.54
4.4.10.0000.0379.54
4.4.00.0030.0409.54
4.3.110.0070.0279.54
4.3.100.0030.0139.54
4.3.90.0000.0379.54
4.3.80.0030.0239.54
4.3.70.0000.0179.54
4.3.60.0100.0079.54
4.3.50.0070.0109.54
4.3.40.0000.0239.54
4.3.30.0030.0179.54
4.3.20.0000.0409.54
4.3.10.0030.0179.54
4.3.00.0000.0339.54

preferences:
38.7 ms | 401 KiB | 5 Q