|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-07-03 07:12 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 28 22:00:01 2025 UTC |
Description: ------------ If the double quote is close to enclosure, fgetcsv parses the line wrong. This is parsed wrong: "200"|"15,4""|"aa" When escaped, it would work: "200"|"15,4\""|"aa" Jozef Reproduce code: --------------- test.csv: "200"|"15,4""|"aa" "200"|"15,4 "|"aa" text.php: <?php $aOut = array(); $handle = fopen("test.csv", "r"); while (($data = fgetcsv($handle, 100, '|', '"')) !== FALSE) { print_r($data); } fclose($handle); ?> Expected result: ---------------- Array ( [0] => 200 [1] => 15,4" [2] => aa ) Array ( [0] => 200 [1] => 15,4 [2] => aa ) Actual result: -------------- Array ( [0] => 200 [1] => 15,4"|aa" ) Array ( [0] => 200 [1] => 15,4 [2] => aa )