I have a large line containing the contents of a CSV file. Until now, I did not care about its parsing, as my program simply broadcast it from one source to another.
Your mission, if you decide to accept it, is to tell me the best way to remove line breaks from data elements of a string containing multiple CSV data lines, without dropping line breaks separating the lines themselves. The data is correctly quoted, and the implementation should run in PHP 5.2 ...
id,data,other
1,"This is data
with a line break I want replacing",1
2,"This is a line with no line break in the data",0
3,No quotes,42
4,"Quoted field with ""quotes inside"" which is tricky",84
source
share