I'm using fgetcsv
to read csv files in my application. Problem is that I don't know if my users will use ,
, |
, or ;
as delimiters. If I tell fgetcsv
nothing it will only accept ,
but if I tell it to use a specific delimiter it will only accept that.
What I'm doing now is:
while (($row = fgetcsv($fileHandle, 4096)) !== false) {
What I want is something like this:
while (($row = fgetcsv($fileHandle, 4096, array(',', ';', '|'))) !== false) {
Is that possible in some easy way? It seems really weird that you would have to limit your delimiter to one specific character, since CSV is not standardized.