&$key_value) { $key_value = api_to_system_encoding($key_value, $from_encoding); } while (($row_tmp = api_fgetcsv($handle, null, ';')) !== false) { $row = array(); // Avoid empty lines in csv. if (is_array($row_tmp) && count($row_tmp) > 0 && $row_tmp[0] != '') { if (!is_null($row_tmp[0])) { foreach ($row_tmp as $index => $value) { $row[$keys[$index]] = api_to_system_encoding($value, $from_encoding); } $result[] = $row; } } } fclose($handle); return $result; } }