The tab character is \t
. Notice the use of "
instead of '
.
$chunk = "abc\tdef\tghi";
If the string is enclosed in double-quotes ("), PHP will interpret more escape sequences for special characters:
...
\t horizontal tab (HT or 0x09 (9) in ASCII)
Also, let me recommend the fputcsv() function which is for the purpose of writing CSV files.