I am using fgetcsv() function in PHP to read CSV file that is generated using Microsoft Excel.
The problem is the CSV file contains value with commas and it reads escaped value (with double quotes) as it is.
E.g: "2,5,7"
is read as "2
& 5
& 8"
The problem can be solved by changing the double quotes into single quote. However I don't want to edit every single CSV file everytime.
The code that I use is as follow:
$handle = fopen($path, "r"); $data = fgetcsv($handle,1000,",","'"); do { **READ CSV** } while ($data = fgetcsv($handle,5000,","));
What would be the best way to handle this issue?
foo(); do { } while (foo())
is better written aswhile (foo()) { }
! – deceze