cvs: phpdoc /en/reference/dir/functions opendir.xml

From: Date: Sun, 23 Feb 2003 18:31:28 +0000
Subject: cvs: phpdoc /en/reference/dir/functions opendir.xml
Groups: php.doc 
Request: Send a blank email to phpdoc+get-969351952@lists.php.net to get a copy of this message
philip Sun Feb 23 13:31:28 2003 EDT Modified files: /phpdoc/en/reference/dir/functions opendir.xml Log: Expand example to use is_dir and filetype, mention E_WARNING, link to @ error operator, and see also readdir and dir class. Index: phpdoc/en/reference/dir/functions/opendir.xml diff -u phpdoc/en/reference/dir/functions/opendir.xml:1.2 phpdoc/en/reference/dir/functions/opendir.xml:1.3 --- phpdoc/en/reference/dir/functions/opendir.xml:1.2 Wed Apr 17 02:37:35 2002 +++ phpdoc/en/reference/dir/functions/opendir.xml Sun Feb 23 13:31:28 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <!-- splitted from ./en/functions/dir.xml, last change in rev 1.2 --> <refentry id="function.opendir"> <refnamediv> @@ -21,9 +21,11 @@ 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. + generates a PHP error of level <link linkend="errorfunc.constants"> + E_WARNING</link>. You can suppress the error output of + <function>opendir</function> by prepending + '<link linkend="language.operators.errorcontrol">@</link>' to the + front of the function name. </para> <para> <example> @@ -31,20 +33,27 @@ <programlisting role="php"> <![CDATA[ <?php +$dir = "/tmp/"; -if ($dir = @opendir("/tmp")) { - while (($file = readdir($dir)) !== false) { - echo "$file\n"; - } - closedir($dir); +// Open a known directory, and proceed to read its contents +if (is_dir($dir)) { + if ($dh = opendir($dir)) { + while (($file = readdir($dh)) !== false) { + print "filename: $file : filetype: " . filetype($dir . $file) . "\n"; + } + closedir($dh); + } } - ?> ]]> </programlisting> </example> </para> - <para>See also <function>is_dir</function>.</para> + <para> + See also <function>is_dir</function>, + <function>readdir</function>, and + <link linkend="class.dir">Dir</link> + </para> </refsect1> </refentry>

« previous php.doc (#969351952) next »