I want to split a CSV string. The string looks like that:
“val1″,”val2″,”val3, some other stuff”, “val4”
As you see, there can be a comma inside the values (see val3), so using explode on the comma wont work.
I also tried:
preg_split('/","/', $myLine)
This does not work though, how would I do that otherwise?
Thanks for your help 🙂
You can use the built in fgetcsv if your data is in a file,
or str_getcsv if your data is a string