0

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?

pillarOfLight
  • 8,592
  • 15
  • 60
  • 90
  • What do the spaces have to do with anything? Your settings indicate you want tabs to separate the values and double quotes to enclose values. So that string should only return one entry with a value of `\A some text with space.` – Mike Brant Jan 30 '13 at 01:30
  • What is your expected output ? – Baba Jan 30 '13 at 01:33

1 Answers1

0

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.

xdazz
  • 158,678
  • 38
  • 247
  • 274