note 53396 added to function.fgetcsv
| From: | phillipatvanessen-onlinedotde at osu1 dot php dot net | Date: | Tue, 31 May 2005 15:42:26 +0000 |
| Subject: | note 53396 added to function.fgetcsv | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-89680@lists.php.net to get a copy of this message | ||
Found a mystic thing within fgetcsv function.
Code:
<?php
$csvfile = fopen('foo.csv','r'); // content of foo.csv -> look further down.
$testarray = fgetcsv($csvfile,1000,";");
print_r($testarray);
?>
Content of foo.csv:
foo bar;foo "bar";"foo" bar;"foo bar"
Expected output of code:
Array
(
[0] => foo bar
[1] => foo "bar"
[2] => "foo" bar
[3] => "foo bar"
)
Effective output of code:
Array
(
[0] => foo bar
[1] => foo "bar"
[2] => foo bar
[3] => foo bar
)
It seems as if fgetcsv does not recognize data starting with quotes.
Is this "working as designed"??
Brgds,
Phillip
----
Manual Page -- http://www.php.net/manual/en/function.fgetcsv.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+53396
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+53396&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+53396&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+53396&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+53396&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+53396&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+53396&report=yes
Search -- http://master.php.net/manage/user-notes.php