Parsing Comma Separated Value (CSV) Files with PHP
I hate trying to parse CSV with PHP. I get PO’d ASAP because everyone should be using TSV instead. I know, it can be as difficult to comprehend all of the acronyms as it is to figure out the comma separated values. Not impossible, just very time consuming.
I have had multiple occasions where someone gives me a file and asks me to parse it. The issue is its in CSV format. CSV Sucks! The problem is when you get someone trying to be cute so they put a comma (,) in one of the records.
So let me back up. CSV started out as a basic format to make data portable. A CSV file is basically a database in a way. Each line in the file represents a record. Each field within the record is delimited by a comma. Or so it is suppose to work. So typical CSV looks like this:
Read more




>
Follow Me (digitally you stalker)