Parsing a CSV File in PHP

Ok so it is one of the most common data files in the world: the CSV (Comma Separated Values). So here is all you need in PHP to extract the data from the file. The data is exploded into an array ($data) and can be accessed via the array index. It is simple and very straight forward, no run with it!

$handle = fopen("test.csv", "r");

while (($data = fgetcsv($handle, 5000, ",")) !== FALSE) {

}

Related Post