Voting

: max(six, five)?
(Example: nine)

The Note You're Voting On

alex /-\-l- windeagle DOT org
15 years ago
TAB delimiting.

Using fputcsv to output a CSV with a tab delimiter is a little tricky since the delimiter field only takes one character.
The answer is to use the chr() function. The ascii code for tab is 9, so chr(9) returns a tab character.

<?php
fputcsv
($fp, $foo, '\t'); //won't work
fputcsv($fp, $foo, ' '); //won't work

fputcsv($fp, $foo, chr(9)); //works
?>

==================

it should be:
<?php
fputcsv
($fp, $foo, "\t");
?>
you just forgot that single quotes are literal...meaning whatever you put there that's what will come out so '\t' would be same as 't' because \ in that case would be only used for escaping but if you use double quotes then that would work.

<< Back to user notes page

To Top