PHP 8.5.0 Alpha 1 available for testing

Voting

: max(eight, nine)?
(Example: nine)

The Note You're Voting On

durik at 3ilab dot net
14 years ago
As the str_getcsv(), unlike to fgetcsv(), does not parse the rows in CSV string, I have found following easy workaround:

<?php
$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.

<< Back to user notes page

To Top