Posts in category For future reference

Properly parsing CSV in PHP

Written on by
.
Filed under

A snippet for future reference, if I ever need to parse a CSV string again. The csv_parse function takes a CSV-formatted string and returns an array (rows) of arrays (columns). The csv_parse_assoc function does the same but converts the header row of the CSV string to array keys.

Continue reading