Voting

: min(zero, five)?
(Example: nine)

The Note You're Voting On

reinhold dot egenter at gmail dot com
4 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

To Top