@ 2017-07-10T11:59:58Z <?php
$array = Array (
'0' => Array (
'NDC_Date' => '2017-03-27',
'NDC_Item' => '0',
'NDC_Type' => 'Night',
'NDC_Rate' => '12.00',
'NDC_Taxes' => '0',
'NDC_TaxesName' => '0',
'NDC_Quantity' => '1',
'NDC_Status' => 'NotCharged',
),
'1' => Array (
'NDC_Date' => '2017-03-28',
'NDC_Item' => '0',
'NDC_Type' => 'Night',
'NDC_Rate' => '12.00',
'NDC_Taxes' => '0',
'NDC_TaxesName' => '0',
'NDC_Quantity' => '1',
'NDC_Status' => 'NotCharged',
),
'2' => Array (
'NDC_Date' => '2017-03-29',
'NDC_Item' => '0',
'NDC_Type' => 'Test',
'NDC_Rate' => '12.00',
'NDC_Taxes' => '0',
'NDC_TaxesName' => '0',
'NDC_Quantity' => '1',
'NDC_Status' => 'NotCharged',
),
'3' => Array (
'NDC_Date' => '2017-03-30',
'NDC_Item' => '0',
'NDC_Type' => 'Test',
'NDC_Rate' => '12.00',
'NDC_Taxes' => '0',
'NDC_TaxesName' => '0',
'NDC_Quantity' => '1',
'NDC_Status' => 'NotCharged',
),
'4' => Array (
'NDC_Date' => '2017-03-31',
'NDC_Item' => '0',
'NDC_Type' => 'Night',
'NDC_Rate' => '12.00',
'NDC_Taxes' => '0',
'NDC_TaxesName' => '0',
'NDC_Quantity' => '1',
'NDC_Status' => 'NotCharged',
),
'5' => Array (
'NDC_Date' => '2017-04-01',
'NDC_Item' => '0',
'NDC_Type' => 'Night',
'NDC_Rate' => '12.00',
'NDC_Taxes' => '0',
'NDC_TaxesName' => '0',
'NDC_Quantity' => '1',
'NDC_Status' => 'NotCharged',
),
'6' => Array (
'NDC_Date' => '2017-04-02',
'NDC_Item' => '0',
'NDC_Type' => 'Night',
'NDC_Rate' => '12.00',
'NDC_Taxes' => '0',
'NDC_TaxesName' => '0',
'NDC_Quantity' => '1',
'NDC_Status' => 'NotCharged',
),
'7' => Array (
'NDC_Date' => '2017-04-03',
'NDC_Item' => '0',
'NDC_Type' => 'Night',
'NDC_Rate' => '12.00',
'NDC_Taxes' => '0',
'NDC_TaxesName' => '0',
'NDC_Quantity' => '1',
'NDC_Status' => 'NotCharged',
),
);
foreach ($array as $item) {
$k = $item['NDC_Type'];
if (!isset($result[$k])) {
$result[$k] = $item;
} elseif (
($i = $result[$k]) &&
$item['NDC_Rate'] === $i['NDC_Rate'] &&
$item['NDC_Item'] === $i['NDC_Item'] &&
$item['NDC_Taxes'] === $i['NDC_Taxes'] &&
$item['NDC_TaxesName'] === $i['NDC_TaxesName'] &&
$item['NDC_Quantity'] === $i['NDC_Quantity'] &&
$item['NDC_Status']=== $i['NDC_Status']
) {
$current_dates = explode(',', $result[$k]['NDC_Date']);
$last_date = end($current_dates);
if(date('Y-m-d', strtotime("{$last_date} +1 day")) === $item['NDC_Date']) {
$result[$k]['NDC_Date'] .= ','. $item['NDC_Date'];
} else {
$result[$k. microtime()] = $item;
}
} else {
$result[$k. microtime()] = $item;
}
}
print_r($result);
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
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).
Version System time (s) User time (s) Memory (MiB) 7.2.9 0.036 0.011 15.16 7.2.8 0.045 0.010 15.02 7.2.7 0.103 0.009 15.16 7.2.6 0.123 0.011 15.41 7.2.5 0.021 0.012 15.45 7.2.4 0.008 0.012 15.21 7.2.3 0.071 0.010 15.25 7.2.2 0.010 0.006 15.23 7.2.1 0.021 0.011 15.37 7.2.0 0.056 0.013 15.44 7.1.21 0.023 0.000 14.28 7.1.20 0.019 0.007 14.14 7.1.19 0.105 0.010 14.23 7.1.18 0.074 0.003 13.96 7.1.17 0.003 0.009 14.34 7.1.16 0.110 0.006 13.94 7.1.15 0.013 0.005 14.12 7.1.14 0.017 0.003 14.27 7.1.13 0.013 0.007 14.18 7.1.12 0.015 0.009 14.09 7.1.11 0.007 0.014 14.17 7.1.10 0.029 0.003 14.32 7.1.9 0.044 0.006 14.28 7.1.8 0.217 0.007 14.05 7.1.7 0.016 0.000 14.18 7.1.6 0.038 0.011 31.97 7.1.5 0.030 0.009 31.82 7.1.4 0.028 0.009 32.30 7.1.3 0.030 0.013 32.14 7.1.2 0.036 0.014 32.13 7.1.1 0.010 0.003 14.26 7.1.0 0.010 0.007 14.04 7.0.31 0.016 0.008 13.69 7.0.30 0.013 0.007 13.69 7.0.29 0.010 0.013 13.34 7.0.28 0.014 0.008 13.50 7.0.27 0.024 0.009 13.55 7.0.26 0.075 0.011 13.64 7.0.25 0.014 0.007 13.54 7.0.24 0.008 0.016 13.50 7.0.23 0.234 0.004 13.44 7.0.22 0.318 0.006 13.38 7.0.21 0.014 0.009 13.64 7.0.20 0.011 0.009 13.58 7.0.19 0.017 0.002 13.65 7.0.18 0.061 0.007 13.45 7.0.17 0.033 0.012 13.71 7.0.16 0.010 0.007 13.57 7.0.15 0.041 0.009 13.52 7.0.14 0.045 0.000 13.73 7.0.13 0.008 0.008 13.47 7.0.12 0.012 0.008 13.74 7.0.11 0.010 0.005 13.84 7.0.10 0.023 0.007 13.79 7.0.9 0.016 0.008 13.65 7.0.8 0.011 0.011 13.74 7.0.7 0.102 0.000 13.54 7.0.6 0.109 0.003 13.68 7.0.5 0.094 0.003 13.80 7.0.4 0.092 0.007 13.52 7.0.3 0.091 0.016 13.85 7.0.2 0.118 0.003 13.67 7.0.1 0.010 0.010 13.46 7.0.0 0.015 0.006 13.85
preferences:dark mode live preview
34.36 ms | 401 KiB | 5 Q