{"action":"created","issue":{"url":"https://api.github.com/repos/thephpleague/csv/issues/55","labels_url":"https://api.github.com/repos/thephpleague/csv/issues/55/labels{/name}","comments_url":"https://api.github.com/repos/thephpleague/csv/issues/55/comments","events_url":"https://api.github.com/repos/thephpleague/csv/issues/55/events","html_url":"https://github.com/thephpleague/csv/issues/55","id":47838711,"number":55,"title":"detectDelimiterList() don't find the correct delimiter","user":{"login":"Heart1010","id":1481680,"avatar_url":"https://avatars.githubusercontent.com/u/1481680?v=3","gravatar_id":"","url":"https://api.github.com/users/Heart1010","html_url":"https://github.com/Heart1010","followers_url":"https://api.github.com/users/Heart1010/followers","following_url":"https://api.github.com/users/Heart1010/following{/other_user}","gists_url":"https://api.github.com/users/Heart1010/gists{/gist_id}","starred_url":"https://api.github.com/users/Heart1010/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Heart1010/subscriptions","organizations_url":"https://api.github.com/users/Heart1010/orgs","repos_url":"https://api.github.com/users/Heart1010/repos","events_url":"https://api.github.com/users/Heart1010/events{/privacy}","received_events_url":"https://api.github.com/users/Heart1010/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/thephpleague/csv/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/thephpleague/csv/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":15,"created_at":"2014-11-05T14:01:50Z","updated_at":"2015-05-04T09:07:01Z","closed_at":null,"body":"I have the following csv file (without a csv header), line 1:\r\n```\r\nSurname;Name;;;;;3316157;12360000;\"Bank name\";DE49123600000003316157;GENODIF1DIR;12,456\r\n```\r\nWith this line detectDelimiterList() can't find the correct delimiter:\r\n\r\n```php\r\n$delimiters_list = $inputCsv->detectDelimiterList();\r\n\r\nif (!$delimiters_list) {\r\n    //no delimiter found\r\n} elseif (1 == count($delimiters_list)) {\r\n    $delimiter = $delimiters_list[0]; // the found delimiter\r\n} else {\r\n    //inconsistent CSV \r\n    var_dump($delimiters_list); // all the delimiters found\r\n}\r\n```\r\nshows:\r\n```php\r\narray(2) {\r\n  [0]=>\r\n  string(1) \",\"\r\n  [1]=>\r\n  string(1) \";\"\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/thephpleague/csv/issues/comments/98643256","html_url":"https://github.com/thephpleague/csv/issues/55#issuecomment-98643256","issue_url":"https://api.github.com/repos/thephpleague/csv/issues/55","id":98643256,"user":{"login":"nyamsprod","id":51073,"avatar_url":"https://avatars.githubusercontent.com/u/51073?v=3","gravatar_id":"","url":"https://api.github.com/users/nyamsprod","html_url":"https://github.com/nyamsprod","followers_url":"https://api.github.com/users/nyamsprod/followers","following_url":"https://api.github.com/users/nyamsprod/following{/other_user}","gists_url":"https://api.github.com/users/nyamsprod/gists{/gist_id}","starred_url":"https://api.github.com/users/nyamsprod/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nyamsprod/subscriptions","organizations_url":"https://api.github.com/users/nyamsprod/orgs","repos_url":"https://api.github.com/users/nyamsprod/repos","events_url":"https://api.github.com/users/nyamsprod/events{/privacy}","received_events_url":"https://api.github.com/users/nyamsprod/received_events","type":"User","site_admin":false},"created_at":"2015-05-04T09:07:01Z","updated_at":"2015-05-04T09:07:01Z","body":"@stof @Heart1010 @cordoval \r\n\r\nAfter a good week-end thinking over this bug I think I found a fix ... so here's what I propose which won't even need a BC break :+1:\r\n\r\nWhen for the same occurence we get multiple answers then we will get a \"word\" instead of a single character this his how it will look like:\r\n\r\n```php\r\n$reader = Reader::createFromPath('/path/to/your/csv/file.csv');\r\n$delimiters_list = $reader->detectDelimiterList(10, [' ', '|']);\r\n//let's pretend that \"|\" appears as often as the \";\" delimiters will get the following result.\r\n$delimiters_list = [\r\n...\r\n     5 => \";|\",\r\n...\r\n];\r\n```\r\nWe can take advantage of the language constructs and do the following:\r\n```php\r\n$list_all_delimiters_found = str_split($delimiters_list[5]);\r\n```\r\nIf you are only interested in having only one result you can do as follow:\r\n```php\r\n$delimiter = array_shift($delimiters_list)[0]; //which will always return the first character found\r\n```\r\nWhat's great with this last piece of code is that if we decide to switch from a word to a real array in v8 this code will still work out of the box.\r\n\r\nIf you like this fix please respond here ASAP so I can implement it and release v7.1\r\n\r\n\r\n\r\n\r\n"}}