oursolutionarchitectoursolutionarchitect

PHP - CSV File


Definition and Usage

The fgetcsv() function parses a line from an open file, checking for CSV fields.

Tip: Also see the fputcsv() function.

Syntax

fgetcsv(file, length, separator, enclosure)

Parameter Values

Parameter Description
file Required. Specifies the open file to return and parse a line from
length Optional. Specifies the maximum length of a line. Must be greater than the longest line (in characters) in the CSV file. Omitting this parameter (or setting it to 0) the line length is not limited, which is slightly slower. Note: This parameter is required in versions prior to PHP 5
separator Optional. Specifies the field separator. Default is comma ( , )
enclosure Optional. Specifies the field enclosure character. Default is "
escape Optional. Specifies the escape character. Default is "\\"