Online Documentation Server
 ПОИСК
ods.com.ua Web
 КАТЕГОРИИ
Home
Programming
Net technology
Unixes
Security
RFC, HOWTO
Web technology
Data bases
Other docs

 РЕКЛАМА

 ПОДПИСКА

 ССЫЛКИ
Colocation
Скоростной интернет
Бесплатный интернет
Wi-Fi
Работа в Киеве
Доставка цветов
Мобильные телефоны
VoIP Billing
Музыка и фильмы
AS numbers, IP addresses
Стройматериалы, инструменты
Flowers delivery Kiev

 АНКЕТА
Как Вам ODS?

 О КОПИРАЙТАХ
Вся предоставленная на этом сервере информация собрана нами из разных источников. Если Вам кажется, что публикация каких-то документов нарушает чьи-либо авторские права, сообщите нам об этом.

 РЕКЛАМА

[Links] [Работа в Киеве] [mp3] [Рефераты] [WiFiver.com
fgetcsv

fgetcsv

(PHP3 >= 3.0.8, PHP4 )

fgetcsv --  Gets line from file pointer and parse for CSV fields

Description

array fgetcsv (int fp, int length [, string delimiter])

Similar to fgets() except that fgetcsv() parses the line it reads for fields in CSV format and returns an array containing the fields read. The field delimiter is a comma, unless you specifiy another delimiter with the optional third parameter.

Fp must be a valid file pointer to a file successfully opened by fopen(), popen(), or fsockopen()

Length must be greater than the longest line to be found in the CSV file (allowing for trailing line-end characters).

Fgetcsv() returns false on error, including end of file.

NB A blank line in a CSV file will be returned as an array comprising just one single null field, and will not be treated as an error.

Example 1. Fgetcsv() example - Read and print entire contents of a CSV file


$row = 1;
$fp = fopen ("test.csv","r");
while ($data = fgetcsv ($fp, 1000, ",")) {
    $num = count ($data);
    print "<p> $num fields in line $row: <br>";
    $row++;
    for ($c=0; $c<$num; $c++) {
        print $data[$c] . "<br>";
    }
}
fclose ($fp);
     


With any suggestions or questions please feel free to contact us