3v4l.org

run code in 300+ PHP versions simultaneously
<?php $classmap1 = array('franz' => null); for ($i=1; $i<=5; $i++) { $classmap1['a'.$i] = $i+1; } $classmap2 = array('franz' => 'de leon'); for ($i=1; $i<=5; $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); $x = merging::merge($classmap1, $classmap2); $endTimeFunc = microtime(true); echo "Func took " . (($endTimeFunc - $startTimeFunc)*1000) ." microseconds<br />\n"; var_dump($x);

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.00.0070.00815.01
7.3.120.0100.00815.07
7.3.110.0050.01214.79
7.3.100.0030.01414.86
7.3.90.0040.00714.84
7.3.80.0080.01014.71
7.3.70.0050.00814.74
7.3.60.0000.01514.61
7.3.50.0110.00514.82
7.3.40.0070.00514.72
7.3.30.0050.00814.71
7.3.20.0050.01116.55
7.3.10.0050.01216.46
7.3.00.0070.00716.65
7.2.250.0050.01315.12
7.2.240.0110.00915.17
7.2.230.0100.00714.93
7.2.220.0050.01015.13
7.2.210.0080.00715.01
7.2.200.0030.01015.11
7.2.190.0000.01515.10
7.2.180.0080.00815.10
7.2.170.0030.00914.98
7.2.160.0030.01215.03
7.2.150.0000.01216.59
7.2.140.0090.00916.59
7.2.130.0100.00716.69
7.2.120.0110.00717.04
7.2.110.0070.01016.79
7.2.100.0070.01016.95
7.2.90.0120.00317.10
7.2.80.0040.01116.96
7.2.70.0100.00317.05
7.2.60.0000.01816.98
7.2.50.0090.00617.04
7.2.40.0100.00717.04
7.2.30.0040.01116.89
7.2.20.0090.00917.04
7.2.10.0070.00317.05
7.2.00.0030.01118.13
7.1.330.0070.00715.75
7.1.320.0080.00815.70
7.1.310.0080.00715.75
7.1.300.0020.01215.63
7.1.290.0100.00515.58
7.1.280.0040.01115.83
7.1.270.0070.00715.56
7.1.260.0030.01015.84
7.1.250.0000.01115.64
7.1.240.0030.01015.90
7.1.230.0070.00715.88
7.1.220.0090.00615.91
7.1.210.0070.00715.85
7.1.200.0070.00715.76
7.1.190.0110.00615.63
7.1.180.0070.00315.81
7.1.170.0110.00415.81
7.1.160.0040.01115.78
7.1.150.0040.00815.63
7.1.140.0060.00915.55
7.1.130.0060.00915.85
7.1.120.0050.00515.82
7.1.110.0070.01015.96
7.1.100.0040.00715.72
7.1.90.0040.00815.89
7.1.80.0070.00715.78
7.1.70.0090.00416.54
7.1.60.0060.01117.58
7.1.50.0060.01116.39
7.1.40.0000.01415.86
7.1.30.0060.00915.84
7.1.20.0040.00715.51
7.1.10.0120.00315.94
7.1.00.0060.02119.07
7.0.330.0070.01015.25
7.0.320.0030.01315.59
7.0.310.0130.00015.54
7.0.300.0090.00615.41
7.0.290.0040.01115.54
7.0.280.0110.00415.43
7.0.270.0040.01215.17
7.0.260.0070.00715.46
7.0.250.0100.00315.56
7.0.240.0060.00315.59
7.0.230.0060.00715.59
7.0.220.0040.01114.96
7.0.210.0060.00615.57
7.0.200.0080.00815.86
7.0.190.0040.00815.57
7.0.180.0040.00715.41
7.0.170.0000.01115.14
7.0.160.0070.00715.50
7.0.150.0070.01015.42
7.0.140.0070.03718.56
7.0.130.0030.01315.32
7.0.120.0030.00615.59
7.0.110.0000.00815.53
7.0.100.0100.04617.67
7.0.90.0200.04317.75
7.0.80.0170.02917.85
7.0.70.0220.04217.77
7.0.60.0290.03617.73
7.0.50.0250.04117.81
7.0.40.0050.05016.83
7.0.30.0050.05016.96
7.0.20.0070.04916.78
7.0.10.0080.04216.85
7.0.00.0100.03116.77
5.6.400.0070.01014.77
5.6.390.0090.00914.66
5.6.380.0090.00614.10
5.6.370.0070.00714.47
5.6.360.0080.00414.72
5.6.350.0030.00914.74
5.6.340.0070.01014.66
5.6.330.0110.00314.68
5.6.320.0030.01014.64
5.6.310.0070.00714.46
5.6.300.0070.00714.87
5.6.290.0070.00314.30
5.6.280.0060.03917.58
5.6.270.0030.01014.69
5.6.260.0060.00914.79
5.6.250.0060.04617.48
5.6.240.0050.04817.54
5.6.230.0060.05217.38
5.6.220.0070.04517.44
5.6.210.0080.04217.29
5.6.200.0020.04217.77
5.6.190.0110.04317.72
5.6.180.0040.04417.85
5.6.170.0080.04117.70
5.6.160.0070.04417.82
5.6.150.0060.04617.74
5.6.140.0070.04317.71
5.6.130.0060.04217.76
5.6.120.0110.04217.73
5.6.110.0100.04217.85
5.6.100.0070.02617.83
5.6.90.0070.04917.65
5.6.80.0050.04617.40
5.6.70.0060.04217.40
5.6.60.0000.03317.31
5.6.50.0060.04417.54
5.6.40.0130.03717.28
5.6.30.0070.04417.44
5.6.20.0080.04117.23
5.6.10.0080.04317.31
5.6.00.0080.04517.40
5.5.380.0050.04217.40
5.5.370.0110.02917.37
5.5.360.0030.04817.55
5.5.350.0100.04517.27
5.5.340.0150.03517.58
5.5.330.0050.04117.71
5.5.320.0150.02517.71
5.5.310.0100.04117.78
5.5.300.0120.04017.69
5.5.290.0070.04517.71
5.5.280.0070.02717.50
5.5.270.0050.04417.61
5.5.260.0020.04817.45
5.5.250.0060.02217.39
5.5.240.0100.03617.38
5.5.230.0050.03017.38
5.5.220.0080.04017.14
5.5.210.0110.03117.37
5.5.200.0100.03817.32
5.5.190.0100.03717.28
5.5.180.0030.04317.41
5.5.170.0090.00014.48
5.5.160.0040.04417.19
5.5.150.0030.04517.27
5.5.140.0050.03817.15
5.5.130.0070.04717.31
5.5.120.0070.04017.35
5.5.110.0170.03317.23
5.5.100.0120.04317.19
5.5.90.0130.03817.19
5.5.80.0060.02517.12
5.5.70.0030.03217.23
5.5.60.0100.03017.20
5.5.50.0020.05017.00
5.5.40.0070.04217.21
5.5.30.0080.04217.13
5.5.20.0100.04317.32
5.5.10.0100.03917.26
5.5.00.0020.04517.31
5.4.450.0050.03315.29
5.4.440.0060.02615.39
5.4.430.0090.03415.23
5.4.420.0030.04615.34
5.4.410.0050.03915.23
5.4.400.0050.04414.92
5.4.390.0070.03415.11
5.4.380.0050.03715.18
5.4.370.0050.03814.82
5.4.360.0050.04014.95
5.4.350.0060.03815.15
5.4.340.0030.02715.11
5.4.330.0000.00911.13
5.4.320.0060.04115.03
5.4.310.0040.02515.17
5.4.300.0040.04315.30
5.4.290.0050.04115.02
5.4.280.0020.03415.18
5.4.270.0090.03715.10
5.4.260.0040.04215.14
5.4.250.0050.04214.98
5.4.240.0030.03815.22
5.4.230.0050.03214.95
5.4.220.0050.02814.97
5.4.210.0080.04215.19
5.4.200.0100.02815.04
5.4.190.0110.03714.96
5.4.180.0080.04015.06
5.4.170.0080.03115.00
5.4.160.0050.03815.01
5.4.150.0070.03715.03
5.4.140.0030.03813.76
5.4.130.0140.03113.87
5.4.120.0030.03713.88
5.4.110.0020.04513.93
5.4.100.0080.03613.82
5.4.90.0070.03913.72
5.4.80.0080.03613.90
5.4.70.0070.03413.71
5.4.60.0070.03513.82
5.4.50.0070.04213.95
5.4.40.0050.04013.82
5.4.30.0090.03513.71
5.4.20.0060.02613.66
5.4.10.0030.02513.81
5.4.00.0110.03213.66
5.3.290.0050.02512.70
5.3.280.0050.03012.62
5.3.270.0090.04112.56
5.3.260.0040.04312.76
5.3.250.0090.03712.66
5.3.240.0070.03812.48
5.3.230.0070.03212.47
5.3.220.0050.03912.50
5.3.210.0080.03812.56
5.3.200.0090.03812.58
5.3.190.0080.03812.60
5.3.180.0050.02812.64
5.3.170.0070.03712.68
5.3.160.0060.03912.64
5.3.150.0060.03512.64
5.3.140.0110.03512.62
5.3.130.0080.03712.64
5.3.120.0080.04012.45
5.3.110.0040.03512.62
5.3.100.0100.02812.31
5.3.90.0030.04312.29
5.3.80.0050.04212.23
5.3.70.0030.03112.25
5.3.60.0060.03012.34
5.3.50.0050.03312.27
5.3.40.0080.02312.30
5.3.30.0030.02012.27
5.3.20.0030.03711.99
5.3.10.0080.03312.07
5.3.00.0070.02412.11
5.2.170.0030.05313.68
5.2.160.0070.05313.68
5.2.150.0030.03013.68
5.2.140.0000.03713.68
5.2.130.0030.04713.68
5.2.120.0070.05713.68
5.2.110.0100.05713.68
5.2.100.0070.05313.68
5.2.90.0070.06013.68
5.2.80.0130.06013.68
5.2.70.0030.06313.68
5.2.60.0030.06313.68
5.2.50.0000.07713.68
5.2.40.0070.05713.68
5.2.30.0070.05013.68
5.2.20.0100.05713.68
5.2.10.0100.04013.68
5.2.00.0170.03713.68
5.1.60.0030.05313.68
5.1.50.0070.02713.68
5.1.40.0030.05313.68
5.1.30.0100.04313.68
5.1.20.0100.05313.68
5.1.10.0070.05713.68
5.1.00.0030.04013.68
5.0.50.0070.04313.68
5.0.40.0030.04313.68
5.0.30.0000.06313.68
5.0.20.0070.04313.68
5.0.10.0000.03313.68
5.0.00.0070.06313.68
4.4.90.0030.03313.68
4.4.80.0030.02313.68
4.4.70.0000.03313.68
4.4.60.0000.03713.68
4.4.50.0000.03313.68
4.4.40.0070.04713.68
4.4.30.0070.03013.68
4.4.20.0000.03713.68
4.4.10.0000.03713.68
4.4.00.0000.05713.68
4.3.110.0100.03013.68
4.3.100.0000.02013.68
4.3.90.0000.03313.68
4.3.80.0100.04713.68
4.3.70.0030.02313.68
4.3.60.0030.01713.68
4.3.50.0030.01713.68
4.3.40.0030.04013.68
4.3.30.0030.02313.68
4.3.20.0070.02313.68
4.3.10.0030.02013.68
4.3.00.0070.01713.68

preferences:
37.52 ms | 401 KiB | 5 Q