Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PHP fputcsv() Function

PHP fputcsv() Function


PHP Filesystem Reference Manual Complete PHP Filesystem Reference Manual


Definition and Usage

The fputcsv() function formats a line as CSV and writes it to an open file.

Returns the length of the written string, or FALSE on failure.

Syntax

fputcsv(file,fields,seperator,enclosure)

Parameters Description
file Required. Specifies the open file to write to.
fields Required. Specifies the array from which to get the data.
separator Optional. Sets the field delimiter (only one character allowed). Default is a comma ( , ).
enclosure Optional. Sets the field enclosure (only one character allowed). Default is a double quote ( " ).

Tips and Notes

**Tip:** See the fgetcsv() function.


Example

Example


PHP Filesystem Reference Manual Complete PHP Filesystem Reference Manual