I have following Text input.
Group 1,Good,LEADS,"Leads Description 1
Leads Description 2","Note 1
Note 2",1,100,210,10,Amt,15%
Group 2,Good, SWITCHING, Switching, Description 1, "Switching Note 1
Switching Note 2",4,130,210,15,Amt,15%
Group 1,Service,LICENCE,Licence Description 1,Licence Note 1,2,200,400,5,Pct,15%
The Description and Note can be in the same line, or can have multi lines value. These are total 3 lines. When description and note is multi line, the Text is in Double Quotes ""
so for line without multi line description or note a simple explode is working but for either of them in multi line. i am using following statement to parse it.
preg_split("/\n|\r\n?/", $text);
this statement works for lines, it only needs to take care of one condition as to consider the text between double quotes as one line.
Edit: the above Text is assigned to $text