I want open a file CSV with php but the input can be with comma or semicolon how i can do that
i open the file with comma like that
if (($handle = fopen($filePath, 'r')) !== false) {
// get the first row, which contains the column-titles (if necessary)
$header = fgetcsv($handle);
while (($data = fgetcsv($handle)) !== false) {
var_dump($data);
}
}
my file can be
Test;option;money
1;a;1,3
2;"G;a";1,965,0
OR
Test,option,money
1,a,"1,3"
2,"G;a",1,"965,0"
how i can test the separator to use fgetcsv ?