note 101890 deleted from function.str-getcsv by danbrown

From: Date: Mon, 17 Jan 2011 14:30:16 +0000
Subject: note 101890 deleted from function.str-getcsv by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-175820@lists.php.net to get a copy of this message
Note Submitter: durik at 3ilab dot net ---- 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.

« previous php.notes (#175820) next »