1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
$compatible_partnums = []; //param &$compatible_partnums //Add the shared identifier and the unique identifier if (array_key_exists('hardwarenum', $items)) { $compatible_partnums[$items['hardwarenum']][] = $items['partnum']; } $compats = array_map(function($k, $v) { return [$k, implode(', ', $v)]; }, array_keys($compatible_partnums), $compatible_partnums); Excel::create($filename. '-hw', function($excel) use($newArray, $compats) { $excel - > sheet('Sheetname', function($sheet) use($newArray, $compats) { $sheet - > fromArray($compats); }); }) - > export ('csv'); |