Parsear Csv in Php

0

It turns out that I have this csv and it is one of the first times I parse one so "complex" I need to know an idea of how to pause it in php.

I need to create an associative array with the csv data, but the problem is that there is only one header in this case. Date, the numbers next to it are the ids corresponding to each pair of numbers.

array example:

Date = > 02/01/2018 Id = > one License = > 139 (Here you have to make a split to separate them)

    
asked by dandan94 16.02.2018 в 15:56
source

1 answer

2

To parse a csv in php you can use the fgetcsv function to get the contents of the file already parsed in an array, if that is not enough you also have functions to work with strings explode to separate it in case it already comes to you in a string.
Then the association of the dates should be simple using an iterative control cut using a foreach or a simple for .

    
answered by 16.02.2018 в 16:04