Syntax
| array fgetcsv ( resource $handle [, int $length [, string $delimiter [, string $enclosure [, string $escape]]]] ); |
Definition and Usage
Similar to fgets() except that fgetcsv() parses the line it reads for fields in CSV format and returns an array containing the fields read.
Paramaters
| Parameter | Description |
|---|---|
| handle | A valid file pointer to a file successfully opened by fopen(), popen(), or fsockopen(). |
| length | Must be greater than the longest line. |
| delimiter | Set the field delimiter (one character only). Defaults as a comma. |
| enclosure | Set the field enclosure character (one character only). Defaults as a double quotation mark. |
| escape | Set the escape character (one character only). Defaults as a backslash (\) |
Return Value
Returns an indexed array containing the fields read.
Example
Following is the usage of this function:
<?php |