update page now

Voting

: three plus four?
(Example: nine)

The Note You're Voting On

reinhold dot egenter at gmail dot com
5 years ago
Please note, that fputcsv ist not always enclosing strings with the enclosure character.
<?php 
$fh = fopen('file.csv', 'w');
$a = [ 'One 1', 'Two', 'Three 3' ];
fputcsv($fh, $a, "\t");
fclose($fh); 
?>

results in a file containing the line:
"One 1" Two "Three 3"
It seems that only strings containing at least one of the following characters are enclosed:
- the delimiter character
- the enclosure character
- the escape character
- \n (new line)
- \r (line feed)
- \t (tab)
- blank 
I hope this saves you the hour it took me to get to the bottom of this behaviour.

<< Back to user notes page

AltStyle によって変換されたページ (->オリジナル) /