I'm trying to read a ** csv file and save it to an array **, but the problem is that the fourth column of the csv file I'm reading has a comma separated text, and this causes when I read the csv file, php separates the text from column 4 into different indexes of the array.
How do I get my code to ignore column 4 or to place column 4 text only in an index?
This is 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;
}