Question

so I have this:

$handle = fopen($filepath, 'r');
$row = fgetcsv($handle, null, "\t", '"');

whereby $filepath contains a file with the following text:

"\A some text with space."

but then when I echo the contents of $row, it's not removing the enclosing quotations marks and the variable will still contain the entire string including the quotation marks despite the fact that there are spaces in them...

What did I do wrong?

Was it helpful?

Solution

fgetcsv returns an array, if the file with the content as you said, then the result of var_dump($row); should be:

array(1) {
  [0]=>
  string(24) "\A some text with space."
}

Then echo $row[0]; is the result, won't have the quotations.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top