3v4l.org

run code in 300+ PHP versions simultaneously
<?php function arrayMergeRecursive($arraySource, $arrayDestination) { $temp = array(); foreach ($arraySource as $key => $value) { if (is_array($value)) { $associatedDestination = array(); if (isset($arrayDestination[$key])) { $associatedDestination = $arrayDestination[$key]; } $temp[$key] = arrayMergeRecursive($value, $associatedDestination); continue; } if (isset($arrayDestination[$key])) { $temp[$key] = $arrayDestination[$key]; } else { $temp[$key] = $arraySource[$key]; } } return $temp; } $source = ["a" => 1, "b" => 2, "c" => ["x" => 1, "y" => 2]]; $x = ["c" => 1, "d" => 10, "a" => 5]; var_dump(arrayMergeRecursive($source, $x)); var_dump(array_replace_recursive($source, $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)
8.3.60.0110.00318.17
8.3.50.0110.00921.93
8.3.40.0120.00318.75
8.3.30.0070.00719.04
8.3.20.0080.00020.16
8.3.10.0070.00323.63
8.3.00.0040.00420.92
8.2.180.0080.00818.41
8.2.170.0090.00919.04
8.2.160.0060.00922.96
8.2.150.0080.00024.18
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0000.00720.56
8.2.110.0040.01822.26
8.2.100.0040.00817.84
8.2.90.0080.00019.14
8.2.80.0000.00817.97
8.2.70.0050.00317.63
8.2.60.0040.00717.80
8.2.50.0030.00618.07
8.2.40.0080.00019.78
8.2.30.0000.00718.21
8.2.20.0040.00417.82
8.2.10.0000.00818.00
8.2.00.0000.00717.67
8.1.280.0100.00325.92
8.1.270.0080.00021.98
8.1.260.0000.00826.35
8.1.250.0000.00828.09
8.1.240.0000.00923.69
8.1.230.0000.01019.16
8.1.220.0000.00817.79
8.1.210.0080.00018.77
8.1.200.0070.00317.23
8.1.190.0060.00317.23
8.1.180.0030.00519.01
8.1.170.0040.00418.57
8.1.160.0000.00722.03
8.1.150.0040.00418.66
8.1.140.0040.00417.39
8.1.130.0030.00317.85
8.1.120.0070.00017.51
8.1.110.0000.00817.47
8.1.100.0040.00417.44
8.1.90.0000.00717.49
8.1.80.0040.00417.44
8.1.70.0070.00017.35
8.1.60.0100.00017.63
8.1.50.0000.00817.47
8.1.40.0040.00417.53
8.1.30.0030.00917.71
8.1.20.0050.00317.49
8.1.10.0030.00617.52
8.1.00.0000.00817.41
8.0.300.0070.00018.77
8.0.290.0040.00417.18
8.0.280.0070.00018.45
8.0.270.0040.00417.29
8.0.260.0060.00017.27
8.0.250.0030.00317.04
8.0.240.0000.00717.04
8.0.230.0000.00716.91
8.0.220.0060.00316.92
8.0.210.0030.00316.91
8.0.200.0070.00016.92
8.0.190.0030.00616.96
8.0.180.0020.00516.88
8.0.170.0000.00716.94
8.0.160.0070.00016.85
8.0.150.0040.00416.89
8.0.140.0000.00716.86
8.0.130.0060.00013.27
8.0.120.0000.00816.90
8.0.110.0060.00316.80
8.0.100.0040.00416.89
8.0.90.0040.00416.90
8.0.80.0090.00616.86
8.0.70.0030.00516.78
8.0.60.0050.00316.94
8.0.50.0000.00716.77
8.0.30.0120.00717.04
8.0.20.0120.00917.40
8.0.10.0040.00417.09
8.0.00.0120.00616.91
7.4.330.0020.00215.00
7.4.320.0030.00316.46
7.4.300.0030.00316.50
7.4.290.0030.00316.59
7.4.280.0050.00216.48
7.4.270.0050.00316.41
7.4.260.0040.00416.63
7.4.250.0040.00416.48
7.4.240.0020.00516.58
7.4.230.0070.00016.41
7.4.220.0060.01116.53
7.4.210.0060.01416.56
7.4.200.0050.00216.55
7.4.190.0070.00016.66
7.4.160.0030.01316.23
7.4.150.0090.01017.40
7.4.140.0110.00617.86
7.4.130.0070.01016.64
7.4.120.0120.01016.59
7.4.110.0070.01016.61
7.4.100.0050.01916.47
7.4.90.0090.00916.67
7.4.80.0040.01519.39
7.4.70.0130.00616.50
7.4.60.0140.00316.39
7.4.50.0030.00616.43
7.4.40.0080.00916.50
7.4.30.0070.01416.52
7.4.10.0120.00615.00
7.4.00.0050.01114.94
7.3.330.0030.00313.34
7.3.320.0050.00013.18
7.3.310.0000.00716.24
7.3.300.0070.00016.34
7.3.290.0090.00916.45
7.3.280.0090.00816.38
7.3.270.0130.00317.40
7.3.260.0110.00716.68
7.3.250.0130.00616.52
7.3.240.0090.00916.60
7.3.230.0060.01016.76
7.3.210.0070.01416.29
7.3.200.0190.00019.39
7.3.190.0100.01016.71
7.3.180.0120.00316.47
7.3.170.0120.00916.56
7.3.160.0030.01316.40
7.3.130.0040.01214.89
7.3.120.0080.00714.79
7.3.110.0130.00615.00
7.3.100.0080.00814.58
7.3.90.0060.01014.88
7.3.80.0080.00314.76
7.3.70.0040.01115.01
7.3.60.0120.00314.85
7.3.50.0090.00414.93
7.3.40.0130.00014.96
7.3.30.0000.00914.97
7.3.20.0100.00316.73
7.3.10.0030.00716.36
7.3.00.0030.00816.54
7.2.330.0110.01116.77
7.2.320.0120.00616.55
7.2.310.0040.01416.56
7.2.300.0040.01416.72
7.2.290.0140.00616.80
7.2.260.0070.00715.09
7.2.250.0110.00815.07
7.2.240.0090.00614.95
7.2.230.0060.00915.29
7.2.220.0070.00314.82
7.2.210.0070.01015.08
7.2.200.0070.01015.13
7.2.190.0110.00315.09
7.2.180.0040.00415.07
7.2.170.0070.01015.10
7.2.160.0090.00314.80
7.2.150.0060.00616.89
7.2.140.0040.01417.04
7.2.130.0110.00016.88
7.2.120.0140.00417.07
7.2.110.0030.00616.93
7.2.100.0040.00417.09
7.2.90.0080.00417.11
7.2.80.0110.00316.75
7.2.70.0030.01616.55
7.2.60.0040.01216.77
7.2.50.0060.01217.08
7.2.40.0100.00317.04
7.2.30.0060.00317.09
7.2.20.0040.00816.61
7.2.10.0090.00617.14
7.2.00.0080.00618.21
7.1.330.0070.00715.88
7.1.320.0040.00416.05
7.1.310.0090.00615.96
7.1.300.0100.00315.80
7.1.290.0090.00315.64
7.1.280.0030.00915.56
7.1.270.0090.00015.58
7.1.260.0050.00515.78
7.1.250.0090.00315.82
7.1.240.0070.00715.47
7.1.230.0000.01415.91
7.1.220.0030.00715.88
7.1.210.0030.01015.51
7.1.200.0040.01115.72
7.1.190.0080.00415.86
7.1.180.0040.01215.92
7.1.170.0070.01016.01
7.1.160.0000.01115.46
7.1.150.0070.00715.76
7.1.140.0070.01015.58
7.1.130.0060.01215.54
7.1.120.0090.00015.79
7.1.110.0060.00615.83
7.1.100.0090.00816.94
7.1.90.0090.00615.82
7.1.80.0030.01015.91
7.1.70.0020.00616.60
7.1.60.0030.01117.74
7.1.50.0050.01416.24
7.1.40.0000.01415.79
7.1.30.0000.01115.87
7.1.20.0040.00415.75
7.1.10.0040.00815.80
7.1.00.0030.04319.13
7.0.330.0070.00715.38
7.0.320.0000.01215.40
7.0.310.0070.00715.35
7.0.300.0000.01215.43
7.0.290.0040.00815.41
7.0.280.0040.00715.43
7.0.270.0100.00615.35
7.0.260.0040.00815.28
7.0.250.0030.01015.45
7.0.240.0070.00715.50
7.0.230.0000.01415.18
7.0.220.0030.00715.62
7.0.210.0070.00715.50
7.0.200.0060.00616.14
7.0.190.0100.00315.48
7.0.180.0120.00615.40
7.0.170.0130.00015.64
7.0.160.0020.00715.30
7.0.150.0030.00915.49
7.0.140.0040.04018.79
7.0.130.0030.00715.64
7.0.120.0040.00715.55
7.0.110.0100.00715.55
7.0.100.0090.00315.37
7.0.90.0030.00715.41
7.0.80.0130.02017.66
7.0.70.0120.04317.57
7.0.60.0070.04317.63
7.0.50.0050.03717.79
7.0.40.0050.05016.80
7.0.30.0050.04016.75
7.0.20.0070.02816.73
7.0.10.0070.03416.79
7.0.00.0040.03416.71
5.6.400.0080.00414.68
5.6.390.0040.01114.85
5.6.380.0070.00314.04
5.6.370.0040.00414.04
5.6.360.0040.01214.45
5.6.350.0100.00614.48
5.6.340.0070.00714.46
5.6.330.0100.00614.38
5.6.320.0060.01014.04
5.6.310.0060.00314.65
5.6.300.0070.00714.56
5.6.290.0030.01314.38
5.6.280.0050.03917.72
5.6.270.0030.01014.58
5.6.260.0060.00314.49
5.6.250.0030.00614.52
5.6.240.0090.00314.13
5.6.230.0070.04217.65
5.6.220.0040.04717.48
5.6.210.0060.04417.51
5.6.200.0120.03817.75
5.6.190.0120.04317.65
5.6.180.0100.04017.67
5.6.170.0090.04017.75
5.6.160.0050.03917.86
5.6.150.0060.04517.56
5.6.140.0110.04117.65
5.6.130.0060.03217.82
5.6.120.0070.04017.73
5.6.110.0050.03017.63
5.6.100.0020.04817.66
5.6.90.0090.03817.78
5.6.80.0030.02717.30
5.6.70.0050.04817.46
5.6.60.0060.04617.25
5.6.50.0080.04617.33
5.6.40.0050.04317.39
5.6.30.0030.04117.32
5.6.20.0080.03717.38
5.6.10.0060.04017.49
5.6.00.0030.02817.49
5.5.380.0120.00314.38
5.5.370.0080.04117.24
5.5.360.0080.02017.21
5.5.350.0090.02717.47
5.5.340.0100.03017.47
5.5.330.0100.03817.50
5.5.320.0080.04317.73
5.5.310.0030.04817.50
5.5.300.0090.03617.57
5.5.290.0050.04317.81
5.5.280.0050.04817.51
5.5.270.0060.02817.70
5.5.260.0080.04617.57
5.5.250.0090.04717.41
5.5.240.0050.02317.27
5.5.230.0030.02617.10
5.5.220.0070.02717.12
5.5.210.0080.04017.28
5.5.200.0080.03817.31
5.5.190.0050.02717.22
5.5.180.0100.03917.28
5.5.170.0030.00814.45
5.5.160.0100.04017.12
5.5.150.0100.04317.30
5.5.140.0100.04017.19
5.5.130.0040.02617.29
5.5.120.0050.04517.29
5.5.110.0030.04617.27
5.5.100.0040.02417.09
5.5.90.0070.04117.19
5.5.80.0050.04517.27
5.5.70.0090.02517.26
5.5.60.0090.04017.19
5.5.50.0100.03517.25
5.5.40.0070.02217.16
5.5.30.0120.03817.20
5.5.20.0020.03017.02
5.5.10.0030.04116.94
5.5.00.0070.02517.11
5.4.450.0060.04015.93
5.4.440.0020.04515.89
5.4.430.0100.02315.92
5.4.420.0090.03715.84
5.4.410.0050.04315.70
5.4.400.0050.03215.62
5.4.390.0080.03315.68
5.4.380.0120.03515.75
5.4.370.0050.04415.76
5.4.360.0040.04415.59
5.4.350.0060.04315.64
5.4.340.0070.03715.77
5.4.330.0030.00712.33
5.4.320.0130.02815.70
5.4.310.0050.03115.68
5.4.300.0100.03815.68
5.4.290.0030.04115.69
5.4.280.0050.03015.73
5.4.270.0110.03315.69
5.4.260.0050.02915.60
5.4.250.0050.03715.79
5.4.240.0050.04115.79
5.4.230.0030.03315.73
5.4.220.0080.02415.69
5.4.210.0070.01915.74
5.4.200.0040.04115.61
5.4.190.0110.02215.62
5.4.180.0070.03915.68
5.4.170.0080.03115.73
5.4.160.0000.04415.70
5.4.150.0030.03015.61
5.4.140.0050.02814.42
5.4.130.0060.02414.37
5.4.120.0070.03214.33
5.4.110.0070.03514.36
5.4.100.0050.03014.36
5.4.90.0050.04214.42
5.4.80.0070.03414.33
5.4.70.0100.03014.37
5.4.60.0020.02914.39
5.4.50.0040.03814.40
5.4.40.0030.02814.41
5.4.30.0090.03714.40
5.4.20.0060.03714.35
5.4.10.0020.03414.38
5.4.00.0100.03814.01
5.3.290.0070.03513.56
5.3.280.0080.01813.43
5.3.270.0040.03713.48
5.3.260.0030.02513.53
5.3.250.0080.03713.48
5.3.240.0070.03313.45
5.3.230.0030.03913.51
5.3.220.0050.04013.42
5.3.210.0020.03913.46
5.3.200.0070.02213.44
5.3.190.0050.03113.52
5.3.180.0030.03813.42
5.3.170.0030.03813.52
5.3.160.0030.02513.49
5.3.150.0060.03213.41
5.3.140.0020.02513.45
5.3.130.0100.03813.47
5.3.120.0050.03113.44
5.3.110.0100.03513.47
5.3.100.0020.04413.18
5.3.90.0050.02913.21
5.3.80.0050.02113.20
5.3.70.0020.02513.19
5.3.60.0060.02213.12
5.3.50.0050.04113.21
5.3.40.0020.03913.17
5.3.30.0040.02513.06
5.3.20.0050.02113.04
5.3.10.0030.04013.05
5.3.00.0070.04012.99
5.2.170.0030.06311.94
5.2.160.0100.03711.94
5.2.150.0070.06011.94
5.2.140.0000.04011.94
5.2.130.0100.04711.94
5.2.120.0070.03311.94
5.2.110.0100.03311.94
5.2.100.0130.02311.94
5.2.90.0030.04711.94
5.2.80.0070.06311.94
5.2.70.0030.03711.94
5.2.60.0070.03011.94
5.2.50.0070.05711.94
5.2.40.0100.04711.94
5.2.30.0100.05311.94
5.2.20.0030.05711.94
5.2.10.0030.06011.94
5.2.00.0000.06711.94
5.1.60.0030.02311.94
5.1.50.0000.04011.94
5.1.40.0000.04011.94
5.1.30.0030.03711.94
5.1.20.0000.05311.94
5.1.10.0070.05711.94
5.1.00.0000.03311.94
5.0.50.0070.03011.94
5.0.40.0030.04011.94
5.0.30.0030.05311.94
5.0.20.0000.03711.94
5.0.10.0070.04011.94
5.0.00.0000.06711.94
4.4.90.0070.03311.94
4.4.80.0030.03711.94
4.4.70.0000.03311.94
4.4.60.0000.01711.94
4.4.50.0030.01711.94
4.4.40.0070.02311.94
4.4.30.0070.01311.94
4.4.20.0070.02311.94
4.4.10.0000.03711.94
4.4.00.0030.04711.94
4.3.110.0070.01311.94
4.3.100.0000.03711.94
4.3.90.0070.03311.94
4.3.80.0030.05311.94
4.3.70.0000.03311.94
4.3.60.0000.02711.94
4.3.50.0000.02311.94
4.3.40.0000.05311.94
4.3.30.0000.02311.94
4.3.20.0030.01711.94
4.3.10.0000.02011.94
4.3.00.0000.03711.94

preferences:
36.83 ms | 401 KiB | 5 Q