From a42cf92d66fd5793f9c6fe0428a7cb243ef0e5f5 Mon Sep 17 00:00:00 2001 From: Daniel Beckham Date: Fri, 23 Feb 2001 22:08:33 +0000 Subject: [PATCH] clarified return value of opendir and added example git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@41791 c90b9560-bf6c-de11-be94-00142212c4b1 --- functions/dir.xml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/functions/dir.xml b/functions/dir.xml index e9c02b7f46..b242204d4b 100644 --- a/functions/dir.xml +++ b/functions/dir.xml @@ -148,6 +148,31 @@ $d->close(); closedir, readdir, and rewinddir calls. + + If path is not a valid directory or the + directory can not be opened due to permission restrictions or + filesystem errors, opendir returns false and + generates a PHP error. You can suppress the error output of + opendir by prepending `@' to the front of + the function name. + + + + <function>opendir</function> Example + +<?php + +if ($dir = @opendir("/tmp")) { + while($file = readdir($dir)) { + echo "$file\n"; + } + closedir($dir); +} + +?> + + +