note 101890 added to function.str-getcsv

From: Date: Sun, 16 Jan 2011 19:42:51 +0000
Subject: note 101890 added to function.str-getcsv
Groups: php.notes 
Request: Send a blank email to php-notes+get-175804@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/101890 Del: integrated -- https://master.php.net/note/delete/101890/integrated Del: useless -- https://master.php.net/note/delete/101890/useless Del: bad code -- https://master.php.net/note/delete/101890/bad+code Del: spam -- https://master.php.net/note/delete/101890/spam Del: non-english -- https://master.php.net/note/delete/101890/non-english Del: in docs -- https://master.php.net/note/delete/101890/in+docs Del: other reasons-- https://master.php.net/note/delete/101890 Reject -- https://master.php.net/note/reject/101890 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#175804) next »