function csvToJson($csv) { // open csv file } //read csv headers // parse csv rows into array $json = []; $json[] = array_combine($key, $row); } // release file handle // encode array to json return json_encode($json);
Problem w tym że zewnętrzny plik csv ma na końcu 2 puste wiersze (Prawdopodobnie 2 entery) i kod zwraca:
array_combine(): Both parameters should have an equal number of elements
jak to mogę poprawić?