I would like to ask what is the efficient way to achieve this.
I have a variable that holds the data below which is to be pass into a CSV file.
"Name","Address","Email","Comment"
", <=, ",", <=, ",", <=, ",", <=, "
"John Smith","USA","john@john.net","No Comment"
What I want to achieve is to remove the second line so that before I push the data into the CSV those characters already remove.
", <=, ",", <=, ",", <=, ",", <=, "
The only thing that I can do right now is to save the data into a file then manipulate it then use it for CSV but I am sure there is a faster way to manipulate.
Your line always looks like that? As Dagon suggested:
http://php.net/manual/en/function.str-replace.php
If that junk data is always every other line, it would be much more efficient just to skip it as you re-build your data into a variable, reading line-by-line.