3v4l.org

run code in 300+ PHP versions simultaneously
<?php $csv = [ ['s1','n1','description 1', 'Helmets'], ['s1','n1','description 1a', 'Helmets'], ['s2','n1','description 2', 'Gloves'], ['s2','n1','description 2a', 'Gloves'], ]; $catMap = [ 'Helmets' => 30, 'Gloves' => 20, ]; $result = []; foreach($csv as $row){ //#1 trimming: $row = array_map('trim', $row); $row = [ 'SKU' => $row[0], 'Product_Name' => $row[1], 'Description' => $row[2], 'Category_ID' => $row[3], ]; $sku = $row['SKU']; //#2 cat remapping assert(isset($catMap[$row['Category_ID']])); $row['Category_ID'] = $catMap[$row['Category_ID']]; //#3 combining if(isset($result[$sku])){ $result[$sku]['Description'] .= ' ' . $row['Description']; }else{ $result[$sku] = $row; } }; var_dump($result);

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.00718.30
8.3.50.0150.00318.45
8.3.40.0120.00618.97
8.3.30.0180.00018.58
8.3.20.0040.00419.10
8.3.10.0040.00423.63
8.3.00.0080.00023.58
8.2.180.0180.00325.92
8.2.170.0090.01222.96
8.2.160.0150.00018.94
8.2.150.0090.00025.66
8.2.140.0040.00424.66
8.2.130.0050.00219.76
8.2.120.0050.00326.35
8.2.110.0060.00319.20
8.2.100.0090.00318.03
8.2.90.0000.00819.36
8.2.80.0000.01117.97
8.2.70.0030.00617.93
8.2.60.0030.00518.05
8.2.50.0060.00318.10
8.2.40.0030.00521.13
8.2.30.0040.00419.20
8.2.20.0050.00318.13
8.2.10.0000.00719.35
8.2.00.0040.00419.37
8.1.280.0120.00425.92
8.1.270.0080.00023.99
8.1.260.0070.00326.35
8.1.250.0040.00428.09
8.1.240.0070.00321.18
8.1.230.0120.00018.80
8.1.220.0040.00417.74
8.1.210.0040.00418.77
8.1.200.0040.00417.23
8.1.190.0080.00417.25
8.1.180.0050.00318.10
8.1.170.0060.00318.88
8.1.160.0080.00018.93
8.1.150.0070.00019.00
8.1.140.0040.00419.52
8.1.130.0000.00718.97
8.1.120.0040.00317.49
8.1.110.0040.00417.43
8.1.100.0060.00317.46
8.1.90.0040.00417.36
8.1.80.0080.00017.36
8.1.70.0040.00417.37
8.1.60.0000.00917.62
8.1.50.0030.00617.51
8.1.40.0040.00417.52
8.1.30.0040.00417.61
8.1.20.0000.00717.61
8.1.10.0050.00317.57
8.1.00.0070.00017.55
8.0.300.0040.00418.77
8.0.290.0030.00516.75
8.0.280.0030.00318.46
8.0.270.0040.00416.78
8.0.260.0000.00817.33
8.0.250.0070.00017.03
8.0.240.0040.00417.00
8.0.230.0070.00016.99
8.0.220.0030.00516.96
8.0.210.0070.00017.00
8.0.200.0030.00316.98
8.0.190.0040.00417.02
8.0.180.0000.00816.99
8.0.170.0000.00816.95
8.0.160.0000.00717.00
8.0.150.0000.00716.93
8.0.140.0040.00316.94
8.0.130.0030.00313.40
8.0.120.0040.00416.92
8.0.110.0000.00716.87
8.0.100.0000.00816.84
8.0.90.0050.00317.03
8.0.80.0070.00916.97
8.0.70.0030.00516.95
8.0.60.0000.00716.76
8.0.50.0040.00416.89
8.0.30.0070.01017.03
8.0.20.0170.01117.42
8.0.10.0040.00417.04
8.0.00.0100.01016.70
7.4.330.0020.00215.55
7.4.320.0060.00016.50
7.4.300.0040.00416.55
7.4.290.0000.00716.61
7.4.280.0080.00016.54
7.4.270.0030.00616.46
7.4.260.0030.00316.56
7.4.250.0070.00016.53
7.4.240.0080.00016.37
7.4.230.0000.00716.71
7.4.220.0050.00216.61
7.4.210.0090.00916.57
7.4.200.0030.00316.69
7.4.160.0090.00816.63
7.4.140.0090.01217.86
7.4.130.0070.01416.40
7.4.120.0090.01016.50
7.4.110.0080.01016.58
7.4.100.0110.01416.52
7.4.90.0060.01216.48
7.4.80.0150.00619.39
7.4.70.0140.00316.50
7.4.60.0060.01416.52
7.4.50.0120.00016.43
7.4.40.0060.01816.57
7.4.00.0030.01215.25
7.3.330.0050.00013.24
7.3.320.0000.00613.18
7.3.310.0030.00316.41
7.3.300.0070.00016.34
7.3.290.0070.00016.29
7.3.280.0030.01216.41
7.3.260.0080.00916.35
7.3.240.0110.00916.49
7.3.230.0160.00316.27
7.3.210.0080.01116.60
7.3.200.0070.01016.46
7.3.190.0150.00316.37
7.3.180.0070.01016.33
7.3.170.0080.00816.52
7.3.160.0060.01216.42
7.3.10.0100.00316.59
7.3.00.0110.00316.32
7.2.330.0060.01216.66
7.2.320.0090.00916.80
7.2.310.0110.01116.79
7.2.300.0050.01216.88
7.2.290.0170.00316.66
7.2.130.0050.01016.70
7.2.120.0080.00416.83
7.2.110.0140.00816.73
7.2.100.0130.00316.80
7.2.90.0080.00816.76
7.2.80.0060.00616.82
7.2.70.0190.00315.97
7.2.60.0190.00815.87
7.2.50.0340.00916.13
7.2.40.0150.00915.99
7.2.30.0140.00816.08
7.2.20.0180.00715.96
7.2.10.0200.00816.05
7.2.00.0160.01415.98
7.1.250.0080.00815.51
7.1.200.0000.01215.79
7.1.170.0250.01113.87
7.1.160.0270.00814.10
7.1.150.0280.00413.84
7.1.140.0230.00314.05
7.1.130.0240.00913.84
7.1.120.0170.01614.01
7.1.110.0240.01013.99
7.1.100.0190.01614.16
7.1.90.0250.01113.79
7.1.80.0300.00914.13
7.1.70.0270.00714.16
7.1.60.0390.01632.07
7.1.50.0420.01332.13
7.1.40.0560.01031.75
7.1.30.0500.01231.98
7.1.20.0500.01632.15
7.1.10.0310.00913.95
7.1.00.0340.00613.96

preferences:
30.22 ms | 400 KiB | 5 Q