Voting

: min(nine, seven)?
(Example: nine)

The Note You're Voting On

maldiran at maldiran dot com
1 month ago
As stated above, if you want to parse the csv later with fgetcsv, you should disable the escape mechanism by setting the escape parameter to empty string. Here is what can happen if you don't:

<?php
$a
= array('xyz\\', 'qwerty');
var_dump($a);
$f = fopen('test.csv', 'w');
fputcsv($f, $a);
fclose($f);

$f = fopen('test.csv', 'r');
$b = fgetcsv($f);
fclose($f);
var_dump($b);
?>

Result :

array(2) {
[0]=>
string(4) "xyz\"
[1]=>
string(6) "qwerty"
}
array(1) {
[0]=>
string(13) "xyz\",qwerty
"
}

As you can see, the output of fputcsv cannot be safely parsed by fgetcsv.

<< Back to user notes page

To Top