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.0140.00318.14
8.3.50.0110.00522.10
8.3.40.0120.00318.54
8.3.30.0100.00318.93
8.3.20.0050.00520.30
8.3.10.0090.00023.57
8.3.00.0030.00520.95
8.2.180.0120.00318.22
8.2.170.0090.00918.99
8.2.160.0140.00022.96
8.2.150.0000.00824.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0080.00020.46
8.2.110.0060.01222.29
8.2.100.0040.00718.34
8.2.90.0040.00419.34
8.2.80.0050.00317.97
8.2.70.0000.00817.75
8.2.60.0060.00317.93
8.2.50.0000.00918.07
8.2.40.0040.00419.88
8.2.30.0070.00018.21
8.2.20.0030.00517.78
8.2.10.0040.00419.96
8.2.00.0000.00717.63
8.1.280.0070.00725.92
8.1.270.0040.00421.89
8.1.260.0050.00326.35
8.1.250.0080.00028.09
8.1.240.0000.01022.60
8.1.230.0100.00318.98
8.1.220.0030.00517.78
8.1.210.0080.00018.77
8.1.200.0040.00417.48
8.1.190.0030.00517.11
8.1.180.0060.00319.01
8.1.170.0040.00418.44
8.1.160.0000.00721.91
8.1.150.0000.00818.57
8.1.140.0050.00217.39
8.1.130.0000.00917.78
8.1.120.0000.00717.49
8.1.110.0070.00017.38
8.1.100.0020.00517.48
8.1.90.0000.00717.48
8.1.80.0000.00717.52
8.1.70.0070.00017.34
8.1.60.0060.00317.60
8.1.50.0080.00017.36
8.1.40.0060.00317.51
8.1.30.0050.00517.64
8.1.20.0080.00017.50
8.1.10.0070.00017.61
8.1.00.0070.00017.54
8.0.300.0000.00719.65
8.0.290.0020.00517.04
8.0.280.0030.00318.38
8.0.270.0030.00517.26
8.0.260.0070.00017.20
8.0.250.0030.00316.99
8.0.240.0000.00716.97
8.0.230.0030.00316.88
8.0.220.0070.00016.91
8.0.210.0000.00716.90
8.0.200.0040.00416.93
8.0.190.0000.00716.95
8.0.180.0000.00716.98
8.0.170.0040.00416.90
8.0.160.0000.00916.88
8.0.150.0000.00716.85
8.0.140.0040.00416.82
8.0.130.0030.00313.30
8.0.120.0050.00216.93
8.0.110.0040.00416.88
8.0.100.0040.00416.91
8.0.90.0070.00016.73
8.0.80.0030.01316.82
8.0.70.0030.00516.75
8.0.60.0040.00416.88
8.0.50.0000.00816.68
8.0.30.0060.01217.15
8.0.20.0120.00617.40
8.0.10.0050.00216.98
8.0.00.0080.01016.64
7.4.330.0000.00515.00
7.4.320.0030.00316.45
7.4.300.0030.00316.61
7.4.290.0000.00716.59
7.4.280.0040.00416.60
7.4.270.0030.00516.52
7.4.260.0000.00716.59
7.4.250.0070.00016.38
7.4.240.0050.00216.62
7.4.230.0030.00316.41
7.4.220.0070.01116.53
7.4.210.0090.00616.58
7.4.200.0000.00716.32
7.4.190.0040.00416.46
7.4.160.0080.00816.48
7.4.150.0180.00017.40
7.4.140.0110.00717.86
7.4.130.0270.01116.43
7.4.120.0080.01016.46
7.4.110.0060.01216.53
7.4.100.0160.00716.56
7.4.90.0120.00616.53
7.4.80.0150.00919.39
7.4.70.0120.00616.76
7.4.60.0070.01016.54
7.4.50.0000.00916.46
7.4.40.0110.00616.38
7.4.30.0150.00716.61
7.4.00.0100.00715.21
7.3.330.0050.00213.39
7.3.320.0050.00013.33
7.3.310.0000.00716.34
7.3.300.0030.00316.23
7.3.290.0090.00616.46
7.3.280.0090.01116.40
7.3.270.0130.00417.40
7.3.260.0120.00616.32
7.3.250.0120.00416.52
7.3.240.0110.00616.28
7.3.230.0130.00316.62
7.3.210.0100.00716.28
7.3.200.0090.00919.39
7.3.190.0100.01016.58
7.3.180.0100.00716.33
7.3.170.0120.00916.42
7.3.160.0030.01416.34
7.3.120.0040.01114.72
7.2.330.0170.00016.58
7.2.320.0120.00916.68
7.2.310.0100.01316.77
7.2.300.0080.01216.57
7.2.290.0070.01116.80
7.2.00.0160.00319.05
7.1.200.0000.00815.74
7.1.100.0210.00618.13
7.1.70.0000.00917.23
7.1.60.0040.01219.46
7.1.50.0060.01917.00
7.1.00.0100.07022.45
7.0.200.0030.00316.79
7.0.140.0070.07322.21
7.0.100.0170.06319.90
7.0.90.0300.07719.87
7.0.80.0200.04019.88
7.0.70.0100.08319.92
7.0.60.0100.04019.90
7.0.50.0200.06320.31
7.0.40.0070.08020.18
7.0.30.0100.08320.09
7.0.20.0130.07320.11
7.0.10.0130.06320.14
7.0.00.0130.05019.95
5.6.280.0030.07320.99
5.6.250.0130.07720.81
5.6.240.0100.04320.61
5.6.230.0070.06720.75
5.6.220.0130.05020.65
5.6.210.0130.06020.58
5.6.200.0070.04721.05
5.6.190.0130.06721.04
5.6.180.0000.08720.94
5.6.170.0070.04721.11
5.6.160.0100.07021.01
5.6.150.0070.05021.06
5.6.140.0070.04021.07
5.6.130.0170.07720.96
5.6.120.0100.05021.09
5.6.110.0070.05021.04
5.6.100.0070.06721.13
5.6.90.0000.08721.09
5.6.80.0100.08020.43
5.6.70.0100.04720.31
5.6.60.0070.08020.47
5.6.50.0100.06720.43
5.6.40.0070.05020.38
5.6.30.0070.07720.40
5.6.20.0070.08020.42
5.6.10.0030.08020.52
5.6.00.0030.06320.52
5.5.380.0100.04320.42
5.5.370.0200.06020.35
5.5.360.0100.04720.39
5.5.350.0030.05020.43
5.5.340.0200.07020.81
5.5.330.0070.08320.84
5.5.320.0030.08320.79
5.5.310.0030.05020.94
5.5.300.0130.06720.80
5.5.290.0130.07320.90
5.5.280.0030.08020.89
5.5.270.0130.05020.77
5.5.260.0100.06720.64
5.5.250.0200.05720.75
5.5.240.0030.07720.27
5.5.230.0070.04720.27
5.5.220.0030.06720.16
5.5.210.0070.07020.16
5.5.200.0030.04020.15
5.5.190.0070.08020.29
5.5.180.0100.04020.27
5.5.160.0030.04320.28
5.5.150.0070.06720.12
5.5.140.0170.06720.21
5.5.130.0200.06320.14
5.5.120.0100.04020.11
5.5.110.0000.08319.99
5.5.100.0100.06720.17
5.5.90.0170.06320.09
5.5.80.0100.06720.12
5.5.70.0130.06020.09
5.5.60.0000.04019.96
5.5.50.0070.05019.96
5.5.40.0100.08019.93
5.5.30.0130.03720.10
5.5.20.0070.07719.89
5.5.10.0070.03720.04
5.5.00.0070.03720.11
5.4.450.0000.08719.28
5.4.440.0170.07719.50
5.4.430.0030.04719.44
5.4.420.0070.07719.20
5.4.410.0070.04319.25
5.4.400.0130.06719.13
5.4.390.0030.05018.85
5.4.380.0070.04318.89
5.4.370.0000.08019.18
5.4.360.0030.05019.20
5.4.350.0030.05719.23
5.4.340.0000.05019.02
5.4.320.0030.07318.85
5.4.310.0000.08318.88
5.4.300.0000.05319.12
5.4.290.0070.03718.84
5.4.280.0000.05318.90
5.4.270.0030.07718.87
5.4.260.0130.06719.23
5.4.250.0030.05319.08
5.4.240.0070.03319.17
5.4.230.0070.07018.89
5.4.220.0100.07319.04
5.4.210.0070.04318.94
5.4.200.0070.07318.94
5.4.190.0100.07318.94
5.4.180.0100.04019.13
5.4.170.0030.04719.13
5.4.160.0070.04018.83
5.4.150.0070.03718.88
5.4.140.0000.04016.50
5.4.130.0030.03716.36
5.4.120.0070.03316.40
5.4.110.0070.03316.39
5.4.100.0000.03316.41
5.4.90.0030.03716.53
5.4.80.0030.03716.45
5.4.70.0030.04316.25
5.4.60.0030.03316.33
5.4.50.0070.03016.33
5.4.40.0100.05316.49
5.4.30.0030.06016.36
5.4.20.0030.04316.33
5.4.10.0030.05716.39
5.4.00.0030.03315.91
5.3.290.0100.03314.78
5.3.280.0100.07014.52
5.3.270.0030.05314.63
5.3.260.0070.03714.72
5.3.250.0030.04714.54
5.3.240.0070.03314.57
5.3.230.0100.03014.62
5.3.220.0100.03314.49
5.3.210.0000.04014.52
5.3.200.0070.03714.63
5.3.190.0100.03014.58
5.3.180.0030.03314.55
5.3.170.0030.04014.63
5.3.160.0070.03314.67
5.3.150.0030.05714.71
5.3.140.0030.06314.51
5.3.130.0130.03714.62
5.3.120.0000.07314.57
5.3.110.0030.03714.61
5.3.100.0070.03313.99
5.3.90.0070.03014.08
5.3.80.0030.03714.07
5.3.70.0030.04013.95
5.3.60.0070.03014.02
5.3.50.0030.03714.09
5.3.40.0070.03714.02
5.3.30.0000.04013.84
5.3.20.0000.04013.72
5.3.10.0000.04013.69
5.3.00.0030.03713.52
5.2.170.0070.05312.16
5.2.160.0030.02712.16
5.2.150.0000.03312.16
5.2.140.0070.02712.16
5.2.130.0000.03712.16
5.2.120.0000.03012.16
5.2.110.0000.03312.16
5.2.100.0000.03012.16
5.2.90.0030.03012.16
5.2.80.0000.03012.16
5.2.70.0000.03012.16
5.2.60.0070.02312.16
5.2.50.0070.02312.16
5.2.40.0030.02712.16
5.2.30.0030.03012.16
5.2.20.0000.03012.16
5.2.10.0030.02712.16
5.2.00.0030.02712.16
5.1.60.0030.02312.16
5.1.50.0030.02312.16
5.1.40.0030.02312.16
5.1.30.0000.04012.16
5.1.20.0030.02312.16
5.1.10.0000.02312.16
5.1.00.0030.02312.16
5.0.50.0000.02012.16
5.0.40.0000.02012.16
5.0.30.0000.03312.16
5.0.20.0000.02012.16
5.0.10.0030.01712.16
5.0.00.0000.02712.16
4.4.90.0000.01712.16
4.4.80.0000.01312.16
4.4.70.0070.01012.16
4.4.60.0030.01312.16
4.4.50.0030.01312.16
4.4.40.0000.02312.16
4.4.30.0000.01712.16
4.4.20.0000.01712.16
4.4.10.0000.01312.16
4.4.00.0000.02712.16
4.3.110.0000.01312.16
4.3.100.0070.01012.16
4.3.90.0030.01312.16
4.3.80.0000.02312.16
4.3.70.0000.01312.16
4.3.60.0000.02012.16
4.3.50.0000.01712.16
4.3.40.0030.02312.16
4.3.30.0000.01712.16
4.3.20.0000.01712.16
4.3.10.0000.01312.16
4.3.00.0030.01312.16

preferences:
51.32 ms | 401 KiB | 5 Q