Code

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.

Subscribe to Code