You are here: is_dir() Function Not Working « All PHP « IT news, forums, messages
is_dir() Function Not Working

Posted by dimo414 on 07/03/06 07:17

I'm developing a script which, at one point, outputs all the folders in
a certain directory into a table. Each cycle in the loop uses is_dir()
and does not output anything if it is not a directory.

I used to have the script output the folders in the same directory as
the script, and everything worked fine. I just changed it, so now,
instead of $dir = dir('.'); it's $dir = dir('subfolder');

Now, when I run the script, It outputs an empty table, as in there are
no folders inside 'subfolder'. I ran this test, to output everything
in the directory, and to output whether the output passes the is_dir()
test.

<?php

$dir = dir('subfolder/');

while (false !== ($file = $dir->read()))
{
echo $file;
echo ' ~ ';
echo is_dir($file);
echo '<br>';
}

?>

The output I receive is:

.. ~ 1
... ~ 1
001 ~
002 ~
003 ~
004 ~

The files 001-004 are all folders, and yet they do not seem to pass
is_dir(). I could not find anything on <a
href="http://us3.php.net/is_dir">PHP.net</a> and I'm at a loss.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация