wez             Sun Jun  1 19:11:52 2003 EDT

  Modified files:              
    /phpdoc/en/reference/filesystem/functions   fread.xml 
  Log:
  Fix copy-n-paste error and explain why do {} while(true) is better than
  while(!feof()) {} in this example.
  
  
Index: phpdoc/en/reference/filesystem/functions/fread.xml
diff -u phpdoc/en/reference/filesystem/functions/fread.xml:1.8 
phpdoc/en/reference/filesystem/functions/fread.xml:1.9
--- phpdoc/en/reference/filesystem/functions/fread.xml:1.8      Fri May 30 20:15:18 
2003
+++ phpdoc/en/reference/filesystem/functions/fread.xml  Sun Jun  1 19:11:51 2003
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.8 $ -->
+<!-- $Revision: 1.9 $ -->
 <!-- splitted from ./en/functions/filesystem.xml, last change in rev 1.25 -->
   <refentry id="function.fread">
    <refnamediv>
@@ -81,7 +81,7 @@
 $handle = fopen ("http://www.php.net/";, "rb");
 $contents = "";
 do {
-    $data = fread ($handle, filesize ($filename));
+    $data = fread($handle, 8192);
     if (strlen($data) == 0) {
         break;
     }
@@ -93,9 +93,13 @@
       </programlisting>
      </informalexample>
     </para>
-
-     
-    
+    <note>
+     <para>
+      The example above has better performance than the traditional approach
+      using while(!<function>feof</function>), as we are saving the overhead
+      of a function call per iteration.
+     </para>
+    </note>
     <simpara>
      See also <function>fwrite</function>, <function>fopen</function>,
      <function>fsockopen</function>, <function>popen</function>,



-- 
PHP Documentation Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to