$input_column_data ) { if ( $input_column_name != $data['pivot_column'] && $input_column_data != '' ) { if ( isset( $input_row[$data['pivot_column']] ) ) { $output_arr[$i][$data['pivot_column']] = $input_row[$data['pivot_column']]; } $output_arr[$i][$data['category_column']] = $input_column_name; $output_arr[$i][$data['data_column']] = $input_column_data; $i++; } } } if ( isset( $output_arr ) ) { $column_keys = array_keys( $output_arr[0] ); foreach ( $column_keys as $column_key ) { $columns[$column_key] = $column_key; } $output_csv = Misc::Array2CSV( $output_arr, $columns, false ); file_put_contents( $output_file, $output_csv ); } } else { echo "ERROR: Unable to parse input file...\n"; } } echo "Done.\n"; } Debug::writeToLog(); //Debug::Display(); ?>