CSV Parser for PHP

This is a snippet of code that I had posted on another of my websites and in doing some cleanup it really fits better here.

I spent last evening working on a Comma Separated Values (CSV) list of titles for a project I'm working on. Below is a snippet of code I worked with. The first method from the suggests using . That woks pretty well but the native function in PHP doesn't handle values (fields) that contain separators (commas) very well and doesn't have the concept of multiple values being delimited by a different delimiter within a field. So I whipped up the parser that comes second in the example below.

Category: 

1 Comment

Line breaks within a property

First off, great parser. However, I am having an issue with a particular CSV file that contains line breaks within property values.

My specific issue is that some of my Street field values have line breaks which are being split by explode and screwing up the entire result.

Do you know of a way to only explode at line breaks if the line break is not between quotes?

Thanks!