danbeck         Fri Feb 23 14:08:33 2001 EDT

  Modified files:              
    /phpdoc/en/functions        dir.xml 
  Log:
  clarified return value of opendir and added example
  
Index: phpdoc/en/functions/dir.xml
diff -u phpdoc/en/functions/dir.xml:1.12 phpdoc/en/functions/dir.xml:1.13
--- phpdoc/en/functions/dir.xml:1.12    Thu Feb 15 16:47:33 2001
+++ phpdoc/en/functions/dir.xml Fri Feb 23 14:08:33 2001
@@ -148,6 +148,31 @@
      <function>closedir</function>, <function>readdir</function>, and
      <function>rewinddir</function> calls.
     </para>
+    <para>
+     If <parameter>path</parameter> is not a valid directory or the
+     directory can not be opened due to permission restrictions or
+     filesystem errors, <function>opendir</function> returns false and
+     generates a PHP error.  You can suppress the error output of
+     <function>opendir</function> by prepending `@' to the front of
+     the function name.
+    </para>
+    <para>
+     <example>
+      <title><function>opendir</function> Example</title>
+      <programlisting role="php">
+&lt;?php
+
+if ($dir = @opendir("/tmp")) {
+  while($file = readdir($dir)) {
+    echo "$file\n";
+  }  
+  closedir($dir);
+}
+
+?&gt;
+      </programlisting>
+     </example>
+    </para>
    </refsect1>
   </refentry>
 


Reply via email to