reference/filesystem/functions/fgets.xml
ea62fb83196997032641b50fe44420305466195e
...
...
@@ -9,9 +9,9 @@
9
9
<refsect1 role="description">
10
10
&reftitle.description;
11
11
<methodsynopsis>
12
-
<type>string</type><methodname>fgets</methodname>
13
-
<methodparam><type>resource</type><parameter>handle</parameter></methodparam>
14
-
<methodparam choice="opt"><type>int</type><parameter>length</parameter></methodparam>
12
+
<type class="union"><type>string</type><type>false</type></type><methodname>fgets</methodname>
13
+
<methodparam><type>resource</type><parameter>stream</parameter></methodparam>
14
+
<methodparam choice="opt"><type class="union"><type>int</type><type>null</type></type><parameter>length</parameter><initializer>&null;</initializer></methodparam>
15
15
</methodsynopsis>
16
16
<para>
17
17
Gets a line from file pointer.
...
...
@@ -23,7 +23,7 @@
23
23
<para>
24
24
<variablelist>
25
25
<varlistentry>
26
-
<term><parameter>handle</parameter></term>
26
+
<term><parameter>stream</parameter></term>
27
27
<listitem>
28
28
&fs.validfp.all;
29
29
</listitem>
...
...
@@ -47,7 +47,7 @@
47
47
&reftitle.returnvalues;
48
48
<para>
49
49
Returns a string of up to <parameter>length</parameter> - 1 bytes read from
50
-
the file pointed to by <parameter>handle</parameter>. If there is no more data
50
+
the file pointed to by <parameter>stream</parameter>. If there is no more data
51
51
to read in the file pointer, then &false; is returned.
52
52
</para>
53
53
<para>
...
...
@@ -63,15 +63,15 @@
63
63
<programlisting role="php">
64
64
<![CDATA[
65
65
<?php
66
-
$handle = @fopen("/tmp/inputfile.txt", "r");
67
-
if ($handle) {
68
-
while (($buffer = fgets($handle, 4096)) !== false) {
66
+
$fp = @fopen("/tmp/inputfile.txt", "r");
67
+
if ($fp) {
68
+
while (($buffer = fgets($fp, 4096)) !== false) {
69
69
echo $buffer;
70
70
}
71
-
if (!feof($handle)) {
71
+
if (!feof($fp)) {
72
72
echo "Error: unexpected fgets() fail\n";
73
73
}
74
-
fclose($handle);
74
+
fclose($fp);
75
75
}
76
76
?>
77
77
]]>
78
78