svn: /phpdoc/en/trunk/reference/spl/splfileobject/ fread.xml
| From: | Peter Cowburn | Date: | Sat, 06 Sep 2014 18:54:10 +0000 |
| Subject: | svn: /phpdoc/en/trunk/reference/spl/splfileobject/ fread.xml | ||
| Groups: | php.doc.cvs | ||
| Request: | Send a blank email to doc-cvs+get-12790@lists.php.net to get a copy of this message | ||
salathe Sat, 06 Sep 2014 18:54:10 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=334795
Log:
fleshed out SplFileObject::fread() a bit
Changed paths:
U phpdoc/en/trunk/reference/spl/splfileobject/fread.xml
Modified: phpdoc/en/trunk/reference/spl/splfileobject/fread.xml
===================================================================
--- phpdoc/en/trunk/reference/spl/splfileobject/fread.xml 2014-09-06 18:54:05 UTC (rev 334794)
+++ phpdoc/en/trunk/reference/spl/splfileobject/fread.xml 2014-09-06 18:54:10 UTC (rev 334795)
@@ -35,9 +35,50 @@
<refsect1 role="returnvalues">
&reftitle.returnvalues;
<para>
- The string read from the file.
+ Returns the string read from the file &return.falseforfailure;.
</para>
</refsect1>
+
+ <refsect1 role="examples">
+ &reftitle.examples;
+ <para>
+ <example xml:id="splfileobject.fread.examples.basic">
+ <title><methodname>SplFileObject::fread</methodname> example</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+// Get contents of a file into a string
+$filename = "/usr/local/something.txt";
+$file = new SplFileObject($filename, "r");
+$contents = $file->fread($file->getSize());
+?>
+]]>
+ </programlisting>
+ </example>
+ </para>
+ </refsect1>
+
+ <refsect1 role="notes">
+ &reftitle.notes;
+ <note>
+ <para>
+ Note that <methodname>SplFileObject::fread</methodname> reads from the current
+ position of the file pointer. Use <methodname>SplFileObject::ftell</methodname>
+ to find the current position of the pointer and
<methodname>SplFileObject::rewind</methodname>
+ (or <methodname>SplFileObject::fseek</methodname>) to rewind the pointer position.
+ </para>
+ </note>
+ </refsect1>
+
+ <refsect1 role="seealso">
+ &reftitle.seealso;
+ <para>
+ <simplelist>
+ <member><function>fread</function></member>
+ </simplelist>
+ </para>
+ </refsect1>
+
</refentry>
<!-- Keep this comment at the end of the file