I've a problem importing a csv file ... The following code gives me something like this:
array(3) { [0]=> string(1) "" [1]=> string(23) "Entfernung " [2]=> string(19) "1.3042 km" }
As you see, the number of characters doesnt match with the real word ("Entfernung" doesnt have 23 characters...) ...
Deeper research shows me that somehow an "invisble" whitspace is after each character (like. " E n t f e r n u n g") ...
How can i get rid of this / or prevent it ?
The Code ($files = array with filenames):
for ($i=0; $i < count($files); $i++) {
$handle = fopen($files[$i], "r");
while ($proc_file = fgetcsv($handle,0,",",";")) {
var_dump ($proc_file);
echo "<br>";
}
Splitting for example "Entfernung" (=$proc_file[1]):
$test = $proc_file[1];
for ($a=0; $a < strlen($test); $a++) {
echo $test[$a]."-";
}
gives me
-E--n--t--f--e--r--n--u--n--g-- --