note 101888 added to function.str-getcsv
| From: | durik at 3ilab dot net | Date: | Sun, 16 Jan 2011 19:39:57 +0000 |
| Subject: | note 101888 added to function.str-getcsv | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-175802@lists.php.net to get a copy of this message | ||
As the str_getcsv(), unlike to fgetcsv(), does not parse the rows in CSV string, I have found
following easy workaround:
$Data = str_getcsv($CsvString, "\n"); //parse the rows
foreach($Data as &$Row) $Row = str_getcsv($Row, ";"); //parse the items in rows
Why not use explode() instead of str_getcsv() to parse rows? Because explode() would not treat
possible enclosured parts of string or escaped characters correctly.
----
Server IP: 69.147.83.197
Probable Submitter: 91.148.6.199
----
Manual Page -- http://www.php.net/manual/en/function.str-getcsv.php
Edit -- https://master.php.net/note/edit/101888
Del: integrated -- https://master.php.net/note/delete/101888/integrated
Del: useless -- https://master.php.net/note/delete/101888/useless
Del: bad code -- https://master.php.net/note/delete/101888/bad+code
Del: spam -- https://master.php.net/note/delete/101888/spam
Del: non-english -- https://master.php.net/note/delete/101888/non-english
Del: in docs -- https://master.php.net/note/delete/101888/in+docs
Del: other reasons-- https://master.php.net/note/delete/101888
Reject -- https://master.php.net/note/reject/101888
Search -- https://master.php.net/manage/user-notes.php