3v4l.org

run code in 300+ PHP versions simultaneously
<?php function checkIfJobAlreadyExistsAndUpdateCsv(array $csvRows) { $thisJob = false; $existingJobsAndItsDetails = []; $items = []; foreach ($csvRows as $index => $row) { echo PHP_EOL . 'This is row 0 value: '. $row[0]; if ($row[0] === 'H') { $thisJob = false; echo PHP_EOL . 'This job number: ' . $thisJob; if ($row[1] == 'BB2') { $thisJob = $row[1]; $existingJobsAndItsDetails[$thisJob]= $thisJob; unset($csvRows[$index]); } } if ($row[0] === 'D' && $thisJob) { echo PHP_EOL . 'This item number: ' . $row[1]; $items[$thisJob][] = $row; unset($csvRows[$index]); } } echo PHP_EOL . 'Final Array: '; foreach ($existingJobsAndItsDetails as $jobId => $thisJob) { echo PHP_EOL . 'This job number: ' . $thisJob; if (isset($items[$thisJob])) { foreach ($items[$thisJob] as $itemRow) { $productCode = $itemRow[1]; echo PHP_EOL . print_r($productCode, 1); } } } return $existingJobsAndItsDetails; } $myArray = [['H','AA1 ','598.12'], ['D','itemA1','PRAWN: KING - BAP - RAW PEELED DEVEINED 16-20 (700GM NETT PACK)'], ['D','itemA2','HADDOCK: FILLET 220-280GM SKINNED (KG)'], ['D','itemA3','SEABASS: WILD - WHOLE 2-3KG (KG)'], ['D','itemA4','MACKEREL: FILLETED LARGE (KG)'], ['H','BB2','68.93'], ['D','itemB1','TUNA : SASHIMI GRADE - LOIN ( KG )'], ['H','CC3','8.5']]; echo print_r(checkIfJobAlreadyExistsAndUpdateCsv($myArray), 1);

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.0130.00318.55
8.3.50.0100.00716.70
8.3.40.0070.00718.79
8.3.30.0030.01018.86
8.3.20.0050.00319.15
8.3.10.0050.00323.53
8.3.00.0080.00023.66
8.2.180.0120.00318.29
8.2.170.0040.01122.96
8.2.160.0170.00019.08
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0000.00820.47
8.2.120.0080.00026.35
8.2.110.0030.00720.33
8.2.100.0050.00517.72
8.2.90.0030.00617.88
8.2.80.0040.00417.97
8.2.70.0000.00817.93
8.2.60.0030.00517.93
8.2.50.0080.00018.10
8.2.40.0000.00819.34
8.2.30.0000.00719.20
8.2.20.0040.00418.00
8.2.10.0000.00819.41
8.2.00.0000.00719.37
8.1.280.0150.00625.92
8.1.270.0000.00822.14
8.1.260.0000.00726.35
8.1.250.0080.00028.09
8.1.240.0040.00422.64
8.1.230.0120.00020.82
8.1.220.0060.00318.77
8.1.210.0030.00618.88
8.1.200.0070.00317.47
8.1.190.0000.00819.01
8.1.180.0040.00418.10
8.1.170.0080.00018.79
8.1.160.0000.00819.00
8.1.150.0000.00718.89
8.1.140.0040.00419.65
8.1.130.0040.00419.06
8.1.120.0040.00417.49
8.1.110.0000.00717.44
8.1.100.0000.00717.32
8.1.90.0040.00417.36
8.1.80.0100.00017.47
8.1.70.0070.00017.45
8.1.60.0000.00917.50
8.1.50.0040.00417.40
8.1.40.0040.00417.52
8.1.30.0030.00817.67
8.1.20.0040.00417.51
8.1.10.0000.00717.64
8.1.00.0030.00617.45
8.0.300.0000.00819.82
8.0.290.0050.00316.75
8.0.280.0000.00718.45
8.0.270.0030.00317.18
8.0.260.0030.00317.18
8.0.250.0000.00816.96
8.0.240.0000.00716.96
8.0.230.0070.00316.89
8.0.220.0000.00716.95
8.0.210.0040.00316.78
8.0.200.0000.00717.00
8.0.190.0000.00816.82
8.0.180.0070.00016.91
8.0.170.0030.00616.93
8.0.160.0040.00416.79
8.0.150.0040.00416.79
8.0.140.0040.00416.87
8.0.130.0000.00613.30
8.0.120.0000.00716.76
8.0.110.0000.00816.79
8.0.100.0060.00316.96
8.0.90.0000.00816.70
8.0.80.0090.00816.88
8.0.70.0040.00416.77
8.0.60.0000.00816.84
8.0.50.0040.00416.93
8.0.30.0090.01217.10
8.0.20.0100.00817.40
8.0.10.0000.00817.07
8.0.00.0110.01016.61
7.4.330.0030.00315.55
7.4.320.0060.00316.51
7.4.300.0030.00316.40
7.4.290.0020.01016.51
7.4.280.0000.00916.50
7.4.270.0030.00316.46
7.4.260.0030.00316.61
7.4.250.0000.00716.47
7.4.240.0040.00416.50
7.4.230.0030.00316.50
7.4.220.0000.00816.59
7.4.210.0080.01116.52
7.4.200.0050.00216.41
7.4.160.0060.01016.55
7.4.140.0090.01017.86
7.4.130.0120.00616.37
7.4.120.0100.01016.50
7.4.110.0050.01116.49
7.4.100.0120.00816.57
7.4.90.0140.01016.47
7.4.80.0120.00919.39
7.4.70.0100.00616.45
7.4.60.0030.01416.60
7.4.50.0070.01116.59
7.4.40.0100.01316.34
7.4.00.0040.01415.05
7.3.330.0000.00513.14
7.3.320.0060.00013.38
7.3.310.0000.00716.40
7.3.300.0070.00016.26
7.3.290.0000.00716.26
7.3.280.0090.00616.40
7.3.260.0070.01116.40
7.3.240.0100.00916.38
7.3.230.0060.01016.40
7.3.210.0080.01116.68
7.3.200.0120.00616.32
7.3.190.0140.00816.40
7.3.180.0090.00616.29
7.3.170.0050.01216.37
7.3.160.0140.00416.58
7.2.330.0100.01016.68
7.2.320.0190.00616.81
7.2.310.0090.00816.70
7.2.300.0030.02216.68
7.2.290.0060.01716.76
7.2.110.0150.00016.70
7.2.80.0310.01014.95
7.2.70.0260.01615.07
7.2.60.0230.01014.81
7.2.50.0170.01015.00
7.2.40.0290.00015.15
7.2.30.0290.00015.04
7.2.20.0220.00615.27
7.2.10.0170.01015.20
7.2.00.0280.00415.02
7.1.200.0070.00315.91
7.1.190.0230.00313.65
7.1.180.0280.00614.11
7.1.170.0220.00613.95
7.1.160.0240.00314.02
7.1.150.0230.00314.02
7.1.140.0210.00613.87
7.1.130.0240.00313.84
7.1.120.0290.01013.86
7.1.110.0160.01314.07
7.1.100.0220.00713.97
7.1.90.0190.01013.69
7.1.80.0180.00913.77
7.1.70.0150.00913.85
7.1.60.0350.00731.75
7.1.50.0420.00931.72
7.1.40.0380.01631.68
7.1.30.0310.01631.73
7.1.20.0370.00931.89
7.1.10.0260.00313.92
7.1.00.0200.00613.82

preferences:
62.82 ms | 401 KiB | 5 Q