CVS update: php3/doc/functions
| From: | rasmus | Date: | Tue, 27 Apr 1999 12:55:20 +0000 |
| Subject: | CVS update: php3/doc/functions | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-5271@lists.php.net to get a copy of this message | ||
Date: Tuesday April 27, 1999 @ 8:55
Author: rasmus
Update of /repository/php3/doc/functions
In directory php:/tmp/cvs-serv2764/doc/functions
Modified Files:
filesystem.sgml
Log Message:
Add fgetcsv
Index: php3/doc/functions/filesystem.sgml
diff -u php3/doc/functions/filesystem.sgml:1.43 php3/doc/functions/filesystem.sgml:1.44
--- php3/doc/functions/filesystem.sgml:1.43 Sat Apr 17 03:13:11 1999
+++ php3/doc/functions/filesystem.sgml Tue Apr 27 08:55:20 1999
@@ -364,6 +364,50 @@
</refsect1>
</refentry>
+ <refentry id="function.fgetcsv">
+ <refnamediv>
+ <refname>fgetcsv</refname>
+ <refpurpose>get line from file pointer and parse for CSV fields</refpurpose>
+ </refnamediv>
+ <refsect1>
+ <title>Description</title>
+ <funcsynopsis>
+ <funcdef>array <function>fgetcsv</function></funcdef>
+ <paramdef>int <parameter>fp</parameter></paramdef>
+ <paramdef>int <parameter>length</parameter></paramdef>
+ </funcsynopsis>
+ <simpara>
+ Similar to fgets() except that fgetcsv() parses the line it reads for
+ fields in CSV format and returns an array containing the fields read.
+ <simpara>
+ fp must be a valid file pointer to a file successfully opened by
+ <function>fopen</function>, <function>popen</function>, or
<function>fsockopen</function>
+ <simpara>
+ length must be greater than the longest line to be found in the CSV
+ file (allowing for trailing line-end characters).
+ <simpara>
+ fgetcsv() returns false on error, including end of file.
+ <simpara>
+ 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>
+ <title>fgetcsv() example - Read and print entire contents of a CSV file</title>
+ <programlisting>
+$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);
+ </programlisting></example>
+
+ </refsect1>
+ </refentry>
+
<refentry id="function.fgets">
<refnamediv>
--
PHP Development Mailing List http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net
For help: php-dev-help@lists.php.net