3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = Array ( 0 => Array ( 'member_id' => 6, 'total' => 1, 'sorting' => 0 ), 1 => Array ( 'member_id' => 7, 'total' => 2, 'sorting' => 1 ) ); $b = Array ( 0 => Array ( 'member_id' => 2, 'total' => 3 ), 1 => Array ( 'member_id' => 6, 'total' => 1 ), 2 => Array ( 'member_id' => 7, 'total' => 2 ) ); $new_array = []; foreach ($a as $key => $data) { $new_array[$key]['member_id'] = $data['member_id']; foreach ($b as $key_1 => $data_1) { if ($data['member_id'] == $data_1['member_id']) { $new_array[$key]['total'] = $data_1['total']; if (isset($data_1['sorting'])) { $new_array[$key]['sorting'] = $data_1['sorting']; } else { $new_array[$key]['sorting'] = $data['sorting']; } break; } else { $new_array[$key]['total'] = 0; $new_array[$key]['sorting'] = $data['sorting']; } } } $new_array1 = []; foreach ($b as $key => $data) { if ($data['member_id'] != isset($new_array[$key]['member_id'])) { $new_array1[$key]['member_id'] = $data['member_id']; $new_array1[$key]['total'] = $data['total']; if (!isset($data['sorting'])) { $new_array1[$key]['sorting'] = isset($new_array[$key]['sorting']) ? $new_array[$key]['sorting'] + 1 : "" ; } } } $array_merge = array_merge($new_array, $new_array1); print_r($array_merge);

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.4.20.0100.01019.52
8.4.10.0060.00319.38
8.3.150.0060.01216.77
8.3.140.0150.00416.70
8.3.130.0070.00316.58
8.3.120.0040.00420.81
8.3.110.0120.00320.94
8.3.100.0080.00024.06
8.3.90.0000.00826.77
8.3.80.0040.00419.36
8.3.70.0090.01318.43
8.3.60.0110.00318.35
8.3.50.0140.00524.50
8.3.40.0000.01518.84
8.3.30.0070.00718.68
8.3.20.0040.00424.18
8.3.10.0000.00824.66
8.3.00.0070.00026.16
8.2.270.0040.01516.46
8.2.260.0040.00417.05
8.2.250.0150.00316.72
8.2.240.0030.00617.37
8.2.230.0090.00622.58
8.2.220.0090.00037.54
8.2.210.0110.00326.77
8.2.200.0060.00318.88
8.2.190.0040.01416.75
8.2.180.0000.01625.92
8.2.170.0140.00718.96
8.2.160.0090.00622.96
8.2.150.0040.00425.66
8.2.140.0040.00424.66
8.2.130.0000.00726.16
8.2.120.0040.00421.05
8.2.110.0100.00021.18
8.2.100.0070.00419.32
8.2.90.0050.00220.41
8.2.80.0080.00020.35
8.2.70.0060.00317.75
8.2.60.0040.00418.04
8.2.50.0030.00618.05
8.2.40.0080.00018.34
8.2.30.0040.00418.13
8.2.20.0080.00018.05
8.2.10.0050.00219.25
8.2.00.0000.00819.25
8.1.310.0070.01118.46
8.1.300.0040.00416.25
8.1.290.0060.00330.84
8.1.280.0150.00025.92
8.1.270.0130.00322.01
8.1.260.0060.00326.35
8.1.250.0040.00428.09
8.1.240.0040.00422.09
8.1.230.0060.00620.92
8.1.220.0030.00517.74
8.1.210.0080.00018.96
8.1.200.0030.00617.48
8.1.190.0080.00017.23
8.1.180.0040.00418.10
8.1.170.0060.00318.61
8.1.160.0000.00718.97
8.1.150.0040.00418.92
8.1.140.0030.00618.95
8.1.130.0100.00020.16
8.1.120.0040.00417.45
8.1.110.0000.00817.50
8.1.100.0000.00917.52
8.1.90.0000.00817.50
8.1.80.0000.00917.40
8.1.70.0030.00517.47
8.1.60.0000.00817.52
8.1.50.0030.00617.48
8.1.40.0000.00817.56
8.1.30.0000.00917.56
8.1.20.0000.00817.70
8.1.10.0060.00317.62
8.1.00.0040.00417.55
8.0.300.0000.00720.03
8.0.290.0000.00916.88
8.0.280.0000.01018.46
8.0.270.0030.00317.93
8.0.260.0040.00418.47
8.0.250.0000.00716.87
8.0.240.0040.00416.92
8.0.230.0070.00016.85
8.0.220.0030.00316.92
8.0.210.0030.00317.01
8.0.200.0070.00016.92
8.0.190.0000.00716.95
8.0.180.0040.00416.93
8.0.170.0070.00316.75
8.0.160.0040.00416.91
8.0.150.0000.00716.83
8.0.140.0030.00616.88
8.0.130.0000.00613.27
8.0.120.0040.00416.86
8.0.110.0040.00416.71
8.0.100.0040.00416.81
8.0.90.0000.00816.86
8.0.80.0050.01216.90
8.0.70.0040.00416.70
8.0.60.0000.00716.96
8.0.50.0050.00316.93
8.0.30.0160.00316.95
8.0.20.0130.01017.01
8.0.10.0070.00316.90
8.0.00.0160.00616.64
7.4.330.0000.00415.55
7.4.320.0040.00416.62
7.4.300.0030.00316.48
7.4.290.0040.00416.48
7.4.280.0080.00016.51
7.4.270.0080.00016.59
7.4.260.0050.00013.33
7.4.250.0030.00316.59
7.4.240.0050.00216.52
7.4.230.0040.00416.51
7.4.220.0030.00316.54
7.4.210.0010.01316.57
7.4.200.0020.00516.41
7.4.130.0130.00616.51
7.4.120.0080.01616.64
7.4.110.0110.00616.48
7.4.100.0070.01016.60
7.4.90.0030.01316.51
7.4.80.0100.00619.39
7.4.70.0350.01816.49
7.4.60.0120.02016.49
7.4.50.0300.00816.61
7.4.40.0240.01416.59
7.4.30.0240.01416.64
7.4.20.0370.00316.35
7.4.10.0190.01716.58
7.4.00.0070.01716.48
7.3.330.0000.00716.27
7.3.320.0000.00513.24
7.3.310.0030.00316.42
7.3.300.0000.00716.26
7.3.290.0100.00716.31
7.3.260.0100.01416.73
7.3.240.0110.00816.44
7.3.230.0120.00916.41
7.3.210.0030.01416.47
7.3.200.0070.01016.46
7.3.190.0260.01016.23
7.3.180.0280.00816.30
7.3.170.0250.00816.40
7.3.160.0340.00316.68
7.3.150.0360.01316.31
7.3.140.0160.02016.55
7.3.130.0290.00716.30
7.3.120.0230.01316.66
7.3.110.0250.00716.59
7.3.100.0220.01016.33
7.3.90.0220.01016.62
7.3.80.0230.00616.30
7.3.70.0220.01116.55
7.3.60.0300.00316.55
7.3.50.0250.01116.36
7.3.40.0190.01116.34
7.3.30.0210.01516.42
7.3.20.0850.00416.41
7.3.10.0190.00616.50
7.3.00.0220.01116.40
7.2.330.0040.01516.64
7.2.320.0120.00616.82
7.2.310.0310.00416.48
7.2.300.0210.01716.44
7.2.290.0120.00616.48
7.2.280.0320.00616.57
7.2.270.0170.01716.63
7.2.260.0220.01916.66
7.2.250.0230.01516.59
7.2.240.0270.00716.74
7.2.230.0240.00816.57
7.2.220.0270.01016.67
7.2.210.0220.00716.55
7.2.200.0230.00816.53
7.2.190.0320.00716.73
7.2.180.0130.01916.78
7.2.170.0170.01016.62
7.2.160.0230.01516.66
7.2.150.0160.00916.78
7.2.140.0670.01816.54
7.2.130.0100.01316.68
7.2.120.0160.00416.63
7.2.110.0140.00716.72
7.2.100.0140.01216.64
7.2.90.0160.01116.40
7.2.80.0130.00616.81
7.2.70.0150.01216.61
7.2.60.0030.02116.52
7.2.50.0150.00816.59
7.2.40.0160.01316.64
7.2.30.0150.01316.65
7.2.20.0400.01316.60
7.2.10.0110.00816.47
7.2.00.0130.01716.67

preferences:
123.77 ms | 403 KiB | 5 Q