|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2015-12-27 12:27 UTC] requinix@php.net
-Status: Open
+Status: Not a bug
[2015-12-27 12:27 UTC] requinix@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Dec 14 17:00:01 2025 UTC |
Description: ------------ The lines are not split correctly at the delimiters, also enclosure characters end up in the resulting array. Test script: --------------- $fh = fopen('test_import.csv', "r"); $header = fgetcsv($fh,$delimiter=';',$enclosure='"', $length=0); //skip headers print_r($header);echo "\n"; $line = fgetcsv($fh,$delimiter=';',$enclosure='"'); print_r($line);echo "\n"; test_import.csv contains A;B;C;D;E;F A;"B";C;"D";E;F Expected result: ---------------- Array ( [0] => A; [1] => B [2] => C [3] => D [4] => E [5] => F ) Array ( [0] => A; [1] => B [2] => C [3] => D [4] => E [5] => F ) Actual result: -------------- Array ( [0] => A;B;C;D;E;F ) Array ( [0] => A; [1] => B [2] => ;C; [3] => D [4] => ;E;F )