0
I’m trying to read a document **csv and save to an array**, but the problem is that the fourth column of the file csv that I am reading, has a comma separated text, and this causes when I read the file csv, the php separates the text of column 4 into different index of the array.
How do I make my code ignore column 4 or put the text of column 4 only in an index?
That’s my code to read the file:
function readCsv($fileName)
{
         if(!file_exists($fileName) || !is_readable($fileName)) return false;
         $header = null;
         $data = array();
         $lines = file($fileName);
         foreach($lines as $line) {
             $values = str_getcsv($line, ',', '\\');
            if(!$header)
                 $header = $values;
             else 
                 $data[] = array_combine($header, $values);
         }
         return $data;
}