Re: Strange is_dir() behavior

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Marcos Mendonça wrote:
Hello

I'm using PHP 4.3.9, under Windows XP with Apache.

I have the following directory structure on a given app, i'm working on.

photos/
      > folder1
      > folder2
      > folder3
      > ... and so on

I'm trying the following code to make a list of folder under photos:

                      $d = dir('photos/');

			while (false !== ($entry = $d->read())) {
			    if (is_dir($entry) && $entry != '.' && $entry != '..')
 			    	echo $entry . "<br />";
			}

For some strange reason, that echoes nothing. is_dir is returning
false on every folder (dir)
under photos, except for '.' and '..' dirs. Can someone explain this?

is_dir() is checking for 'folder1', 'folder2' etc. You want it to check 'photos/folder1', 'photos/folder2'....

Use:
if (is_dir('photos/' . $entry) ....

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux